Forum Discussion

M_SBS_6's avatar
M_SBS_6
Icon for Helper V rankHelper V
2 years ago

Measure groupby text column

Hi, 

I have a text column (days_group) which is a grouping of days (I.e 1-10, 11-20, 21-30) and I am trying to create a measure for each groupings so I can see the value by month on the x-axis. 

 

However, my measure for Jan and 1-10, 11-20, 21-30 all have the same value, like it's taking the full total opposed to splitting them out by the group. 

 

Test = Calculate ([cumulative_amount_days_group],

Test[days_group] = "1-10")

 

My value for Jan and days_group "1-10" is 100 but I get 400 as 11-20 = 250 and 21-30 = 50.

6 Replies

  • Hello,

     

    What is the DAX expression of the measure cumulative_amount_days_group? Are the data fields used in that measure from the same data table Test or being filtered by tha data table Test?

    • M_SBS_6's avatar
      M_SBS_6
      Icon for Helper V rankHelper V

      Hi Zang_Mi the measure for cumulative_amount_days_group is 

       

      Calculate(

      Sum( test[test_amount], 

      Filter(

      Allselected(test),

      Test[test_date] <= Test[test_date])),Group by test, test[days_group]))

      • Zang_Mi's avatar
        Zang_Mi
        Icon for Resolver II rankResolver II

        Hello, I build a small sample based on your description, this is a way to calculate cumulative value per month, hope that can help you to adjust your measure.


        Measure:

         

        measure test_amount ALLSELECTED = 
        VAR CURRENT_MONTH = SELECTEDVALUE(test[test_date])
        VAR CURRENT_DAYS_GROUP = SELECTEDVALUE(test[days_group])
        RETURN CALCULATE(SUM(test[test_amount]), FILTER(ALLSELECTED(test), test[test_date] = CURRENT_MONTH && test[days_group] <= CURRENT_DAYS_GROUP))

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi M_SBS_6 ,

    Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

    If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

    How to Get Your Question Answered Quickly 

    Regards,

    Xiaoxin Sheng