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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors