Reply
avatar user
Anonymous
Not applicable
Partially syndicated - Outbound

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

Syndicated - Outbound

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.

avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)