- Multiple DAX Measures Creation methodsThere are different ways we can build multiple measures at once in Power BI, and we can ask AI to build us the scripts to do the job for us. First,I will tell AI what tables I have from the publicly available Adventure Works database and then ask for generate some useful measures we can… Read more: Multiple DAX Measures Creation methods
- DAX Server Timings in DAX StudioWe can take a measure like the one customer order measure, add it to a card visual, and use the performance analyzer to give us the DAX query, which we can paste into the performance analyzer. However, we may see different results if we use it in a matrix, so we will test that too.… Read more: DAX Server Timings in DAX Studio
- Testing DISTINCTCOUNT() in DAXThe DISTINCTCOUNT() function can slow down reports, but if it’s required, then what are the alternatives? Test 1: Adventure Works The measures all give the same results, but which one is faster? We can test these measures by opening the above matrix for all years to give us a bit more data. The results are… Read more: Testing DISTINCTCOUNT() in DAX
- Working with Virtual Tables in DAX MeasuresTesting DAX table functions We can test the speed of measures using the performance analyzer in Power BI to see which table function used in a formula performed best. Below are the results of 10 tests per measure. SUMMARIZECOLUMNS() and SELECTCOLUMNS() are neck and neck, with the old SUMMARIZE() function finishing last. Typically, when working… Read more: Working with Virtual Tables in DAX Measures
- How to use the Window and OFFSET Functions in DAX Measures:The Window Function To use the Window function, we can start by creating a virtual table of customer sales by sales key using the CALCULATETABLE function and then creating a window on the table to return only the results we want by position. We can make use of DAX query to do this. As you… Read more: How to use the Window and OFFSET Functions in DAX Measures:
- How to filter DAX Measures In Power BIThe application of various filter arguments is crucial to controlling the output of DAX measures when visual filters are present on a report page. When CALCULATE() is used in an expression, any filters applied will override any existing filters on the filter being applied.e.g. CALCULATE(SUM(V_FactOnlineSales[SalesAmount]), V_DimProduct[BrandName]=”Litware”)Any filter on V_DimProduct[BrandName]is removed and the new filter is… Read more: How to filter DAX Measures In Power BI
- How to Create Multiple Measures With Power BI DAX Query EditorCreating multiple measures in DAX Query Editor It may be useful to create templates for creating DAX models, using commonly used DAX measures. Here we create a template for commonly used sales measures, such as Sales YTD, Sales Last Year, Sales Year on Year, and Sales Year on Year %, we can then apply the… Read more: How to Create Multiple Measures With Power BI DAX Query Editor
- How to use the Index Function in DAX MeasuresDemonstrating the use of the Index function with the Contoso Retail Data warehouse. We can start off by building a virtual table in the DAX query editor, which we can use to apply the Index function. The table creates is a list of the first 10 customers by customer key from the DimCustomer table. If… Read more: How to use the Index Function in DAX Measures
- How to use the RankX Function in DAX MeasuresUsing the RANK() Function in DAX To demonstrate the use of the DAX function, we’ll start by creating a simple sales table with the sales amount and the year. Then we’ll add additional columns to create examples of using the RANK function. In the first example (SimpleSalesRank), we’ll just create a simple ranking. The default… Read more: How to use the RankX Function in DAX Measures
- Useful Power BI DAX Code ExamplesDAX Code Examples:1. Using Variables2. FORMAT()3. HASONEVALUE()4. AND, &&5. CALCULATETABLE() and SUMMARIZE()6. USERELATIONSHIP()7. SWITCH()8. ISFILTERED() and making visual transparent9. SELECTEDVALUE() and creating a dynamic Graph Title10. FILTER and ADDCOLUMNS11. RANK() VAR: Using Variables Running Total = VAR MaxDateInFilterContext = MAX ( Dates[Date] ) //variable 1 max date#VAR MaxYear = YEAR ( MaxDateInFilterContext ) //variable 2… Read more: Useful Power BI DAX Code Examples
- DAX Running Total Quick Measure verus a Human Created MeasureDax Running TotalAn example we start of we a sales and date table to crate our running table sales from. We start by creating a sales measure as follows: Sales = SUM(FactSales[SalesAmount]) Next we create a quick measure to create the ;Running Total in Sales’ and add it to our table: The Code for the… Read more: DAX Running Total Quick Measure verus a Human Created Measure
- How to calculate Week-to-Date Sales in a DAX MeasureIf you look around the DAX functions, you are going to be disappointed. There is no week-to-date function like there is in Tableau. There are different methods you can google, but let’s create our one here from scratch.In this example, we are using the FactOnlineSales table from the Contoso Retail DW.Before we start, want can… Read more: How to calculate Week-to-Date Sales in a DAX Measure