cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

Cumulative dax query help

Hi
We are using power bi with ssas tabular model using connect live option.
Need help in cumulative column
Report format is as below

Matrix view

Year. 2018. 2019
Item. Trxcount. Cumulative Trx...... Cumul
A. 10. 10. 11. 11
B. 20. 30. 22. 33
C. 30. 60. 33. 66

Need help is writing dax query for cumulative measure
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Helper V
Helper V

Re: Cumulative dax query help

Hi @mwegener 

 

@Thanks for your inputs!!

Used below formula(similar)..replaced selected value by hasonevalue and it worked..

 

Thanks !!

Measure =
CALCULATE (
    [Sales],
    FILTER (
        ALLSELECTED ( 'Table'[Category] ),
        'Table'[Category] <= SELECTEDVALUE ( 'Table'[Category] )
    )
)

 

View solution in original post

23 REPLIES 23
Highlighted
Super User IV
Super User IV

Re: Cumulative dax query help

Hi @GuestUser 

 

Try this pattern.

Cumulative Quantity :=
CALCULATE (
    SUM ( Transactions[Quantity] ),
    FILTER (
        ALL ( 'Date'[Date] ),
        'Date'[Date] <= MAX ( 'Date'[Date] )
    )
)

 Read this article for more info 
https://www.daxpatterns.com/cumulative-total/

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn



Highlighted
Helper V
Helper V

Re: Cumulative dax query help

Hi @Mariusz 

 

have tried this and its giving same value for all items same like transaction count

 

need the cumulative value item wise

 

any suggestion pls

Highlighted
Super User IV
Super User IV

Re: Cumulative dax query help

Hi @GuestUser 

 

Would you mind to:

  • Create a data sample 
  • Provide an expected result based on that sample
  • Provide the DAX expression that you have tried

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Highlighted
Community Support
Community Support

Re: Cumulative dax query help

Hi @GuestUser ,

 

You need to group by Year with ALLEXCEPT() function.

Refer to the following DAX:

Measure =
CALCULATE (
    SUM ( 'Table'[Value] ),
    FILTER (
        ALLEXCEPT ( 'Table', 'Table'[Year] ),
        'Table'[Value] <= MAX ( 'Table'[Value] )
    )
)

Here is the result.

2-1.PNG

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
Highlighted
Helper V
Helper V

Re: Cumulative dax query help

Hi @v-eachen-msft 

 

Thanks !!

 

The Item column is from different table and Value Column is from different table like

 

Item Dimesnion - Item 

Fact - Value

Date Dimesnion -- Year

 

Tried this

 

Measure =
CALCULATE (
SUM ( 'Fact'[Value] ),
FILTER (
ALLEXCEPT ( 'Fact', 'Date'[Year] ),
'Fact'[Value] <= MAX ( 'Fact'[Value] )
)
)

 

But it didnt work as expected...any suggestions pls

 

Highlighted
Community Support
Community Support

Re: Cumulative dax query help

Hi @GuestUser ,

 

Could you please share your sample data here if you don't have any Confidential Information? Please upload your files to OneDrive for Business and share the link here.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
Highlighted
Super User III
Super User III

Re: Cumulative dax query help

Hi @GuestUser ,

 

try this.

 

Cumulative Trx = 
CALCULATE(
	[Trxcount],
	FILTER(
		ALLSELECTED('Item'[Item]),
		ISONORAFTER('Item'[Item], MAX('Item'[Item]), DESC)
	)
)

 

 

PBIX

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

I work at KUMAVISION AG , one of the world's largest
implementation partners for Microsoft Dynamics. #BetterTogether
twitter - LinkedIn - YouTube - website

Highlighted
Helper V
Helper V

Re: Cumulative dax query help

Hi @mwegener 

 

While using MAX function , i get the error ...max function can work only on numbers or dates and not string data types

I am using Connect Live (SSAS Tabular)

 

just for trying....I checked on pbix file where  import method was used ...it works there...

Any idea ..why is it so??

 

Any suggestions on how to implement in connect live?

 

Highlighted
Super User III
Super User III

Re: Cumulative dax query help

Hi @GuestUser ,

 

I am currently not working with SSAS Tabular, but it is documented in the DAX Guide as follows.

Returns the largest value in a column, or the larger value between two scalar expressions. Ignores logical values. Strings are compared according to alphabetical order.

https://dax.guide/max/

 

Which version are you using?

 

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

I work at KUMAVISION AG , one of the world's largest
implementation partners for Microsoft Dynamics. #BetterTogether
twitter - LinkedIn - YouTube - website

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Super Users of the Quarter - Q2 2020

Super Users of the Quarter - Q2 2020

Who are our Super User Superstars? Who made it to the top of the leaderboards? Get the answers!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Community Summit Australia – Join Online!

Community Summit Australia – Join Online!

Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.

Top Solution Authors
Top Kudoed Authors