Forum Discussion
sharong
3 years agoHelper I
Running Total for non date column
I am trying to do running total on non date column. I am trying to show it in a table visual. I have 18k rows. Following the below dax, its working for me if i limit rows to first 1000 rows. But for...
NikhilChenna
3 years agoSkilled Sharer
Hi sharong ,
Is this the output you want ?
Regards,
Nikhil Chenna
Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!
sharong
3 years agoHelper I
Hi NikhilChenna
I tried using the below codes. It takes some 4-5 minutes to load the table. Is there any way of optimizing the below code. Can you help me out.
TestRank = IF(ISBLANK([Total Receivables]), BLANK(),
RANKX (
SUMMARIZE (
ALLSELECTED ( Table ),
Table[CUSTOMER_NO], Table[CUSTOMER_NAME], Table[COMPANY_CODE], Table[COUNTRY], Table[BUSINESS_UNIT]
),
CALCULATE ( SUM ( Table[Total Receivables] ) ),
,
DESC,
DENSE
))
-----------------------------
-----------------------------
Test Running Total =
VAR CurrentRank = [TestRank]
VAR Summarizetable =
CALCULATETABLE (
SUMMARIZE ( Table, Table[CUSTOMER_NO], Table[CUSTOMER_NAME], Table[COMPANY_CODE],Table[BUSINESS_UNIT],Table[COUNTRY] ),
ALLSELECTED ( Table )
)
VAR small =
ADDCOLUMNS ( Summarizetable, "@Sales", [Total Receivables], "@Rank", [TestRank] )
VAR Result =
SUMX ( FILTER ( small, [@Rank] <= CurrentRank ), [@Sales] )
RETURN
Result