Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all
Thanks in advance.
I need the result like this
Regards
SRK
Data | ||||
PRODUCT | qty | % | **bleep** | **bleep**% |
P1 | 3970 | 25.64% | 3970 | 25.64 |
P5 | 3000 | 19.38% | 6970 | 45.02 |
P7 | 2013 | 13.00% | 8983 | 58.0185 |
P4 | 2000 | 12.92% | 10983 | 70.9359 |
p3 | 2000 | 12.92% | 12983 | 83.8533 |
P8 | 1000 | 6.46% | 13983 | 90.312 |
P2 | 1000 | 6.46% | 14983 | 96.7707 |
DEMO | 500 | 3.23% | 15483 | 100 |
Grand Total | 15483 | 100.00% |
My data is like this...
YEAR | SHORTNAME | DEALER | TYPE | PRODUCT | APR | MAY | JUN | JUL | AUG | SEP | OCT | NOV | DEC | JAN | FEB | MAR | TOTAL QTY | TOTALVAL | YEAR |
20182019 | DEMO | DEMO | STD | DEMO | 0 | 0 | 500 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 500 | 23397.5 | 2018 |
20182019 | CBE | D1 | STD | P1 | 0 | 3000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3000 | 143580 | 2018 |
20182019 | CBE | D1 | STD | P2 | 0 | 1000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1000 | 69110 | 2018 |
20192020 | CBE | D2 | STD | P1 | 0 | 970 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 970 | 72284.4 | 2019 |
20192020 | CBE | D2 | STD | P4 | 0 | 2000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2000 | 95720 | 2019 |
20192020 | CBE | D3 | STD | P5 | 0 | 3000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3000 | 143580 | 2019 |
20202021 | CBE | D3 | STD | p3 | 0 | 2000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2000 | 95720 | 2020 |
20202021 | CBE | D4 | STD | P7 | 0 | 2013 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2013 | 96342.2 | 2020 |
20202021 | CBE | D4 | STD | P8 | 0 | 1000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1000 | 46902.8 | 2020 |
Solved! Go to Solution.
Here is a sample implementation.
Thanks for the **bleep** joke.
PBIX is attached.
This works so well for a task i'm working on. But I'd like to understand the logic behind it instead of just copy your finished work. Can you walk me through the DAX (put as simply as it can be) if you don't mind? Highly appreciated! Thank you!
The measure [Rnk] computes the ranking across all products in the table, regardless of any applied filters. (it behaves much like a calculated column, but this can be modified if you need flexibility/filters)
Rnk = RANKX(ALL('Table'[PRODUCT]),calculate(sum('Table'[Val])))
The cumulative value needs to summarize the value for the "current" product and all products that have a "higher" (ie smaller) rank. However this doesn't work for the Row Subtotal as that would then overcount the sum (it would add 1+1+2+1+2+3+1+2+3+4 etc).
This issue can be turned sideways to make it an advantage.
var ta = SUMMARIZE(ALLSELECTED('Table'),'Table'[PRODUCT],"SM",sum('Table'[Val]))
ta is a table variable that lists the individual products and their sums. If we are in a table cell we need to grab the subset of the results as per [Rnk] but in the Row SubTotal we can use the entire table.
var t = topn([Rnk],ta,[SM],DESC)
t is another table variable, but this time it only fetches the rows from 1 to [Rnk] from our summary table based on the sum being sorted descending. This is a little cheeky as we are abusing the [Rnk] measure for row selection. Technically you could have done the same with a proper RANKX, but where's the fun in that?
The last thing we have to do is figure out where in the table/matrix we are. if HASONEVALUE is true then we are in the table cell, otherwise we are in the row subtotal.
return if(hasonevalue('Table'[PRODUCT]),sumx(t,[SM]),sumx(ta,[SM]))
for the table cell we provide the sum of sums of the sub-table t, for the row subtotal it is the sum of sums of the full table ta.
thanks a lot ...
Is it possible to count the number of products for cumulative % total ?
ie.,
Total number of products upto 50% - 2
Total number of products upto 90% - 5
Total number of products upto 100% - 9
That's basically the rank. Add the "rnk" field to the output.
Rank gives only the ranking based on value from 1 to ......
But I need the count of products
Results like
Contribution by products based on **bleep**% | No of products |
50% | 2 |
90% | 5 |
99% | 7 |
100% | 8 |
Hi,
Your desired result is not clear. Please show the result in an MS Excel workbook with your workings.
Ah ok. Use a Pareto chart, or provide your own ranking table to RANKX (with custom "value" items)
RANKX function (DAX) - DAX | Microsoft Docs
Will you always report on 50/90/99/100 or do you plan to use different cuts?
50/90/99/100 ... the same cuts i used to have in my repors..
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |