Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
I have the following DAX measure:
Solved! Go to Solution.
Hi @zameenakarmali
Thank you for reaching out to the Microsoft Fabric Community Forum.
Regarding your query on creating DAX measure that dynamically evaluates premium values based on a selected month and the contract's start and end month numbers.
while I’m not fully aware of the exact structure of your dataset, I’ve created a sample .pbix file to demonstrate one possible solution.
Please try the below DAX:
Premium =
VAR Selected_Month_Number = SELECTEDVALUE(Dim_Date[Month No])
RETURN
CALCULATE (
SUMX (
'Data',
SWITCH (
TRUE(),
'Data'[Ending Month Number] = 0, 'Data'[Gross Sales],
'Data'[Starting Month Number] <= Selected_Month_Number
&& 'Data'[Ending Month Number] >= Selected_Month_Number, 'Data'[GBP Premium],
0
)
),
REMOVEFILTERS(Dim_Date)
)
I’ve attached a few screenshots and the .pbix file demonstrating this logic. Please review them to see if this solution aligns with your requirements.
If this doesn’t fully meet your needs, could you kindly share a sample of your data and more detailed context? That would help us provide a more accurate solution.
If this response resolves your query, kindly mark it as Accepted Solution to help other community members. A Kudos is also appreciated if you found the response helpful.
Additionally, thank you @amitchandak for your prompt response.
Thank You!
Hi @zameenakarmali
Thank you for reaching out to the Microsoft Fabric Community Forum.
Regarding your query on creating DAX measure that dynamically evaluates premium values based on a selected month and the contract's start and end month numbers.
while I’m not fully aware of the exact structure of your dataset, I’ve created a sample .pbix file to demonstrate one possible solution.
Please try the below DAX:
Premium =
VAR Selected_Month_Number = SELECTEDVALUE(Dim_Date[Month No])
RETURN
CALCULATE (
SUMX (
'Data',
SWITCH (
TRUE(),
'Data'[Ending Month Number] = 0, 'Data'[Gross Sales],
'Data'[Starting Month Number] <= Selected_Month_Number
&& 'Data'[Ending Month Number] >= Selected_Month_Number, 'Data'[GBP Premium],
0
)
),
REMOVEFILTERS(Dim_Date)
)
I’ve attached a few screenshots and the .pbix file demonstrating this logic. Please review them to see if this solution aligns with your requirements.
If this doesn’t fully meet your needs, could you kindly share a sample of your data and more detailed context? That would help us provide a more accurate solution.
If this response resolves your query, kindly mark it as Accepted Solution to help other community members. A Kudos is also appreciated if you found the response helpful.
Additionally, thank you @amitchandak for your prompt response.
Thank You!
@zameenakarmali , try like
RETURN
CALCULATE(
SUMX('Data', if('Data'[Ending Month Number] =0,'Data'[Gross] , 'Data'[GBP Premium]) ), 'Contract Detail'[Starting Month Number] <= Selected_Month_Number && 'Data'[Ending Month Number] >= Selected_Month_Number, REMOVEFILTERS(Dim_Date))