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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
EmilLykke
Regular Visitor

Cumulative Total (grouped)

Hi all!

I have a bit of a issue, and I now searched the web empty for solutions to my problem.

I have a table of customers, which I update everyday for changes in their information. If a customer gets in a new group i will create a new row in my table, with the "new" information about the customer. The table updates on every change, but i'm specially looking for changes in what group they are placed in (From 1 to 6). 
As for the picture below, you can see all of my customers on the 14. of febuary and which group they are placed in. On the 15. one customer has been moved to group 4 (the total is now 61, and not 60 as on the 14.).

EmilLykke_0-1708335723401.png

I would like to show cumulative values on every date. By that showing 61 in group 4 on the 15. of february and so on for every group. 

The measure used in the picture is:

Cumulative =
VAR __TABLE =
    FILTER (
        ALLSELECTED ( Dato[Dato] ),
        Dato[Dato] <= MAX (Dato[Dato] )
    )
VAR __VAL =
    SUMX (
        __TABLE,
        [No. of Customers] -- (Just a distinctcount on customers)
    )
RETURN __VAL
4 REPLIES 4
v-kaiyue-msft
Community Support
Community Support

Hi @EmilLykke ,

 

Please follow these steps:

1.Create the measure and write the following dax expression:

Cumulative Grouped Total =

VAR SelectedDate = MAX ( 'Table'[Dato] )

VAR CumulativeData =

    FILTER (

        ALLSELECTED ( 'Table' ),

        'Table'[Dato] <= SelectedDate

    )

RETURN

CALCULATE(COUNT('Table'[No. of Customers]),CumulativeData,'Table'[Group] = MAX('Table'[Group]))

2.Create measure values so that the correct TOTAL totals can be displayed in the matrix.

Measure =

var _table=

SUMMARIZE('Table','Table'[Group],"Value_Column",[Cumulative Grouped Total])

return

IF(

    ISINSCOPE('Table'[Group]),[Cumulative Grouped Total],SUMX(_table,[Value_Column]))

3.The final result is shown below.

vkaiyuemsft_0-1708414035668.png

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

Thanks @v-kaiyue-msft!
This actually gives med the same result as @amitchandak's answer. The problem is still to fill in the empty spaces, with a cumulative total for the group.

Note: I didn't get your second measure to function, but did this instead:

IF(HASONEFILTER('Table'[Group])
, [Cumulative Grouped Total]
, SUMX(VALUES('Table'[Group'),([Cumulative Grouped Total]))
)
amitchandak
Super User
Super User

@EmilLykke , You should prefer a separate date table in such with measures like

 

 

Cumm Sales = CALCULATE([No. of Customers] ,filter(all('Date'),'Date'[date] <=max('Date'[date])))

Cumm Sales = CALCULATE([No. of Customers] ,filter(allselected(date),date[date] <=max(date[Date])))

Cumm Based on Date = CALCULATE([No. of Customers] , Window(1,ABS,0,REL, ALL('date'[date]),ORDERBY('Date'[date],ASC)))

Cumm Based on Date = CALCULATE([No. of Customers] , Window(1,ABS,0,REL, ALLSELECTED('date'[date]),ORDERBY('Date'[date],ASC)))

Thanks, @amitchandak
I found a simalar solution the other day, but it only triggers a column, if there has been made any changes in that column. See below. This is close to what i'm looking for, but I want it to do, what it does in column 5 on the 20. So I still need a running total, even if there hasn't been made any changes. 

EmilLykke_0-1708412029825.png

- This is with the measure, you replied with: 
Cumm Based on Date = CALCULATE([No. of Customers] , Window(1,ABS,0,REL, ALL('date'[date]),ORDERBY('Date'[date],ASC)))

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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