- 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