Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
faisalt
Frequent Visitor

How to pass multi column to remove filter using All in Dax formula in power bi

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 entryAttribute 1Attribute 2Attribute 3SalesPurchase
01-01-2022AC 10005009
01-02-2022   400300
01-03-2022DDd30004000
01-04-2022E f200050000
01-05-2022FC 20001000
01-06-2022Gdf30002000
01-07-2022 df10002000
01-09-2022Gcf2000100

 

 

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   

 

0 REPLIES 0

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.