cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lafteure Frequent Visitor
Frequent Visitor

Sum with grouping step

Hi everyone !

 

I have a simple table, like this one : 
Capture1.PNG

I want to create a measure with different steps : 
1 - Sum "Qty" column grouping on "Product" column
2 - Evaluate if the result of "Step 1" is negative. If it's true, return 0 else return "Step 1"
3 - Sum "Step 2" 

The result i'm expecting for this dataset is : 27
I can't specify in my measure every products with a switch formula because in my original dataset there is between 700 and 3500 different cases.
An important information is that, in the bar chart which will show the measure evolution through time, there is no "Product" filter context. 

Any idea ? 🙂

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
M_L Frequent Visitor
Frequent Visitor

Re: Sum with grouping step

Hi @Lafteure 

This measure may help

M_Product = 
VAR __Step1 = SUMMARIZE(TableProduct;TableProduct[Product];"TotalProduct";sum(TableProduct[Qty]))
VAR __Step2and3 = CALCULATE(SUM([Qty]);FILTER(__Step1;[TotalProduct]>0))
RETURN __Step2and3

Let me know if that is fine. 

View solution in original post

2 REPLIES 2
Highlighted
M_L Frequent Visitor
Frequent Visitor

Re: Sum with grouping step

Hi @Lafteure 

This measure may help

M_Product = 
VAR __Step1 = SUMMARIZE(TableProduct;TableProduct[Product];"TotalProduct";sum(TableProduct[Qty]))
VAR __Step2and3 = CALCULATE(SUM([Qty]);FILTER(__Step1;[TotalProduct]>0))
RETURN __Step2and3

Let me know if that is fine. 

View solution in original post

Lafteure Frequent Visitor
Frequent Visitor

Re: Sum with grouping step

Hi @M_L,

This is perferct thanks for your time !

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)