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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Aakash_Ladi
Regular Visitor

Can we have a common DAX expression which can be used in multiple measures

I have measures in which I am using DAX to filter two fact tables and then perform some aggregation. I have written the same filtering condition in almost 50 measures. Is it somehow possible that I can save these filtering conditions somewhere outside of measure(something like Global Variable)?

2 REPLIES 2
FreemanZ
Super User
Super User

This is a legitimate request, but there is no Global Variable in DAX. 

Do you think there is any workaround for this?

My measures are something like this:

abc = CALCULATE(SUM(column_nme),

FILTER(factTable1, pointDate >= factTable1[Date1] && pointDate <= factTable1[Date2]),

FILTER(factTable2, pointDate >= factTable2[Date1] && pointDate <= factTable2[Date2]),

TREATAS (values(Date1[col1]), factTable2[DateCol1]),

TREATAS (values(Date2[col2]), factTable1[DateCol1])

)

 

There are 40-50 such measures and users want to see at least 10 of them together. Now, When I am putting them together in a matrix visual, they are taking a long time to evaluate, 20 mins to be accurate. I think this is due to filtering two fact tables at once(both the fact tables are huge, 15 million rows in one and 5 million in another) and that too for every measure. Do you think there is any way that I can optimize the performance?

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

Top Solution Authors