Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

How to apply filter before calculating Cumulative Sum?

Kümülatif Bireysel = IF(
            
            VALUES(HamData[siralama]) >= 1 && VALUES(HamData[siralama]) <= 12
            ,
                CALCULATE(
                SUM(Hamdata[Hedef_Tutar]), 
                FILTER(Hamdata, Hamdata[GroupBuName] = "Bireysel"), 
                FILTER(Hamdata, Hamdata[Hedef_Tutar] <> 0),
                FILTER(ALLSELECTED(HamData), HamData[siralama] <= MAX(HamData[siralama]))
                         )
            ,
            "-"
            )

Using DAX, I want to find the cumulative Sum of the "Hedef_Tutar" column. My table is called "HamData". Actually, I have 4 conditions. Below are my terms.

HamData[Siralama] >= 1
HamData[Siralama] <= 12
HamData[GroupBuName] = "Bireysel"
HamData[Hedef_Tutar] <> 0

I want to get Cumulative total after above conditions are completed. But when I run this DAX, Getting a cumulative sum without applying filters;

  • HamData[GroupBuName] = "Bireysel"
  • HamData[Hedef_Tutar] <> 0

How can I get a cumulative total after applying these filters?

 

Thank you so much!

2 Replies

  • Anonymous , Try like

     

    Var _m1 = CALCULATE(
    SUM(Hamdata[Hedef_Tutar]),
    FILTER(Hamdata, Hamdata[GroupBuName] = "Bireysel" && Hamdata[Hedef_Tutar] <> 0)
    return
    calculate(_m1, FILTER(ALLSELECTED(HamData), HamData[siralama] <= MAX(HamData[siralama]))
    )

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi,

    I tried your DAX but no result. It applies the following condition, but does not take a cumulative total.

    FILTER(Hamdata, Hamdata[GroupBuName] = "Bireysel" && Hamdata[Hedef_Tutar] <> 0)