The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have been looking every where for some assistance in summarising data with DAX code to get the following output. I have option 1 and 2 but preference is option 2.
Original Data | ||
Order | Suf | Amount |
500 | 0 | 200 |
500 | 1 | 150 |
500 | 1 | 200 |
500 | 2 | 300 |
501 | 0 | 400 |
502 | 0 | 300 |
502 | 0 | 200 |
502 | 1 | 400 |
502 | 1 | 300 |
502 | 2 | 100 |
503 | 3 | 100 |
Output
Option 1 | |||
Order | Amount | Suf | Amount |
500 | 850 | 0 | 200 |
500 | 1 | 350 | |
500 | 2 | 300 | |
501 | 400 | 0 | 400 |
502 | 1400 | 0 | 500 |
502 | 1 | 700 | |
502 | 2 | 100 | |
502 | 3 | 100 |
Option 2 - Prefered | |||||||||
Order | Total | Suf | Amount | Suf | Amount | Suf | Amount | Suf | Amount |
500 | 850 | 0 | 200 | 1 | 350 | 2 | 300 | ||
501 | 400 | 0 | 400 | ||||||
502 | 1400 | 0 | 500 | 1 | 700 | 2 | 100 | 3 | 100 |
Solved! Go to Solution.
You can create the calculated table like this.
Table 2 =
SUMMARIZE (
'Table',
'Table'[Order],
"Total", SUM ( 'Table'[Amount] ),
"Suf 0", CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Suf] = 0 ),
"Suf > 0", CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Suf] > 0 )
)
Or did you mean in a table visual which would be like this.
I have updated the attached .pbix with both.
You can create the calculated table like this.
Table 2 =
SUMMARIZE (
'Table',
'Table'[Order],
"Total", SUM ( 'Table'[Amount] ),
"Suf 0", CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Suf] = 0 ),
"Suf > 0", CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Suf] > 0 )
)
Or did you mean in a table visual which would be like this.
I have updated the attached .pbix with both.
Thanks for looking into it. The problem with the data set is that Suf could go to 999. At the end, I am more interested in total of Suf 0 and then the total of all Suf >0.
Also I need the data in a new table with Total Order, Total Suf 0 and Toal for Suf>0
User | Count |
---|---|
86 | |
84 | |
36 | |
34 | |
34 |
User | Count |
---|---|
93 | |
79 | |
66 | |
55 | |
52 |