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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

DAX to increment a variable if variation is >= 50%

Hi, 

I want to count the number of enteries when the varaition between two months was equal or greater than 50 percent.

The DAX is been created as follows:

DSC Road Transport - Diesel YTD =

var nowe = CALCULATE(
        SUM('FAV_OE_LOGICS_BUSINESS_METRICS_DATA (2)'[DSC Road Transport - Diesel]),
        ALLSELECTED('Calendar'[Date].[Date]))


var prev = CALCULATE(
        SUM('FAV_OE_LOGICS_BUSINESS_METRICS_DATA (2)'[DSC Road Transport - Diesel]),
        PREVIOUSMONTH('Calendar'[Date].[Date])
    )

var variation= DIVIDE((nowe - prev),prev)

return IF(variation>= 0.50,1,0)

 

In the return statement, I have just conditioned it to mark 0 or 1 but I need a variable to increment everytime when the variance is greater than or equal to 50% and at last it should return me percent of values which is obeying this variation condition.

 

Thanks and Regards

Rajkaran Singh

 

 

1 REPLY 1
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

Can you provide sample data for testing? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures or Excel. I look forward to your response.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
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! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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