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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Passing arguments to DAX Measure

Hello everyone,

Need help in below expression....I have a measure called MTD FORMULA like this.

MTD FORMULA=IF(VALUE(MONTH(MaxDate)))='12' AND CEILING(DAY(MAXDATE/7),1)< CALCULATE(MAX(MaxNumOfPayWeeksInMonth),FILTER(FACT1, FACT1[MONTH] = "12/2019")),
CALCULATE(SUM(MID_MONTH_NET_AMOUNT), FILTER(FACT1, FACT1[MONTH] = "12/2019" && FACT1[WeekNum] = "<=2")),
CALCULATE(SUM(MTD_NET_AMOUNT), FILTER(FACT1, FACT1[MONTH] = "12/2019"))).

 

Now, i want to use this for other multiple measures as MTD FORMULA(12),MTD FORMULA(11)....I want the MTD FORMULA expression to be static and i should be able to pass arguments such as 12,11 etc...for this i need to have a variable in MTD FORMULA that will accept the arguments passed and replace the varuiable with value.

 

Please help me get out of this.

Thankyou

1 REPLY 1
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

I think that you want to create a custom DAX function which has parameters. I am afraid that Power BI doesn't support it currently.

However you could use VAR to define some static formula like VAR a = SUM(MID_MONTH_NET_AMOUNT).

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.