Forum Discussion

ikhwan_tokenomy's avatar
ikhwan_tokenomy
Frequent Visitor
3 years ago
Solved

Incorrect Subtotal

Hi

I have a DAX for custom measure with the formula of

 

Prev Day User Asset USD Latest Rate = CALCULATE(sum('user daily asset'[amount_usd_latest_rate]),PREVIOUSDAY(Dates[Date]))

 


The DAX will give result like below. Where the prev day value of each day is correct, but on the subtotal of the month, its showing the previous day record of the first date instead of the SUM of all the prev day value.

How can this be fixed?

 



Thanks

  • daXtreme's avatar
    daXtreme
    3 years ago

    Maybe this:

    [Prev Day User Asset USD Latest Rate] =
    sumx(
        values ( Dates[Date] ),
        calculate (
            SUM( 'user daily asset'[amount_usd_latest_rate] ),
            PREVIOUSDAY( Dates[Date] )
        )
    )

     

4 Replies

  • daXtreme's avatar
    daXtreme
    Solution Sage

    Hi ikhwan_tokenomy 

     

    What should the logic be behind this measure? How do you want to aggregate? You've not shown this... And please always remember that one picture is worth a thousand words 🙂

      • daXtreme's avatar
        daXtreme
        Solution Sage

        Maybe this:

        [Prev Day User Asset USD Latest Rate] =
        sumx(
            values ( Dates[Date] ),
            calculate (
                SUM( 'user daily asset'[amount_usd_latest_rate] ),
                PREVIOUSDAY( Dates[Date] )
            )
        )