Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I have one requirement where I need to overwrite the filter context using All key word in Power bi Dax
In the table there are two value columns: Sales and Purchase and one date column .My calculation is based on these column
Simply dividing Sales by Purchase .But there are many attributes column with text values I want to remove the filter context for Purcashe calculation .My data will look like below
Date of entry | Attribute 1 | Attribute 2 | Attribute 3 | Sales | Purchase |
01-01-2022 | A | C | 1000 | 5009 | |
01-02-2022 | 400 | 300 | |||
01-03-2022 | D | D | d | 3000 | 4000 |
01-04-2022 | E | f | 2000 | 50000 | |
01-05-2022 | F | C | 2000 | 1000 | |
01-06-2022 | G | d | f | 3000 | 2000 |
01-07-2022 | d | f | 1000 | 2000 | |
01-09-2022 | G | c | f | 2000 | 100 |
My Dax formula looks like this:
mOHR_rate =calculate(sum(table_name[Sales]),year(table_name[Date of entry]) = max(year(table_name[Date of entry])))/calculate(sum(table_name[Purchase]),year(table_name[Date of entry]) = max(year(table_name[Date of entry])),all(table_name[Attribute1],all(table_name[Attribute2],all(table_name[Attribute3]))
here I have put all attributes in the dax simply putting coma which will throw error
Any one can help me how to write this .Only for purchase(denominator calculation ) I want to remove the filter for any number of attribute columns.Or is there any other way to do this calculation So that in future If data gets more attributes automatically measures will take All parametre value from on excel file for the 'ALL' condition instead of hard coding in measure with attributes names .This data is dummy data
User | Count |
---|---|
97 | |
85 | |
77 | |
66 | |
62 |
User | Count |
---|---|
110 | |
96 | |
95 | |
64 | |
57 |