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
Paiman
Frequent Visitor

Cumulative by multiple criteria and date range

Hello,

I've stuck on to solve this using dax measure. I have example table called "Crypto", 

 

CommodityRecomTrade_DateRisk_MonthValue
BTCRecommended10/12/20181/1/2020803
ETHRecommended11/30/20181/1/2020115
BTCRecommended11/28/20181/1/2020750
ETHRecommended12/27/20181/1/2020137
ETHNot Recommend1/31/20191/1/2020839
ADANot Recommend

9/29/2018

2/1/2020531
ADARecommended10/31/20182/1/2020755
BTCNot Recommend12/30/20181/1/2020727
ADANot Recommend11/25/20182/1/2020902
ETHRecommended2/28/20191/1/2020148
BTCRecommended1/25/20191/1/2020253
ADARecommended12/15/20182/1/2020669

 

I'd like to make cumulative based on several criterias :
1. column Commodity & Recom are determined using slicer, example : choose BTC & Recommended
2. cumulative grouped only within each risk_month frame, example : BTC cumulative within 1/1/2020, then 2/1/2020, etc.
3. cumulative based on smallest trade date by considering those 2 criterias mentioned above.

Here's my result expectation :

Paiman_0-1621670601755.png

Thanks a lot for the help
Adrian

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @Paiman 

I am not sure if I understood your question correctly.

I assume you are showing the expected outcome by using different data.

Please check the below.

 

Picture1.png

Cumulative Measure =
CALCULATE (
SUM ( Crypto[Value] ),
FILTER (
ALLEXCEPT ( Crypto, Crypto[Risk_Month], Crypto[Commodity], Crypto[Recom] ),
Crypto[Trade_Date] <= MAX ( Crypto[Trade_Date] )
)
)
 
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi, @Paiman 

I am not sure if I understood your question correctly.

I assume you are showing the expected outcome by using different data.

Please check the below.

 

Picture1.png

Cumulative Measure =
CALCULATE (
SUM ( Crypto[Value] ),
FILTER (
ALLEXCEPT ( Crypto, Crypto[Risk_Month], Crypto[Commodity], Crypto[Recom] ),
Crypto[Trade_Date] <= MAX ( Crypto[Trade_Date] )
)
)
 
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Thanks a lot, you've helped me so much.. this is the solution i was looking for

Fowmy
Super User
Super User

@Paiman 

Please check the following measure and let me know how it works for you.

Cumm = 
var __tradedate = MAX(Table12[Trade_Date]) return
CALCULATE(
    SUM(Table12[Value]),    
    Table12[Trade_Date] <= __tradedate,
    VALUES(Table12[Risk_Month]),
    ALLSELECTED(table12)
)

Fowmy_0-1621673019279.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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