Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hello everyone,
I would very much appreciate any help and advice on the following please.
I have a table and would like to perform some calculations, the inputs to which will change, depending on slicer values. I think I therefore need to use Measures instead of Columns (?).
Below is an example: the first 3 columns are imported data. The measure is a sum of the $ Amount per Sales Person - which I performed using CALCULATE(SUM(Sales[$ Amount]), ALLEXCEPT(Sales, Sales[Salesperson]))
What I now want to do is $ Amount / Total (e.g. for row 1: 200 / 1000) however I can't seem to do this in DAX. I've been reading and I understand that is because I can't pass a table as a parameter (I tried (Divide(Table[$Amount], Measure.Total), 0) but that didn't work).
Please can someone advise on a measure that will perform Table.$ Amount / Measure.Total for each row.
Table.Date | Table.Salesperson | Table.$ Amount | Measure.Total | Measure.Day % (Help) |
1st Feb | Bob | 200 | 1000 | 20% |
1st Feb | Jessica | 200 | 1200 | 17% |
2nd Feb | Bob | 300 | 1000 | 30% |
2nd Feb | Jessica | 400 | 1200 | 33% |
3rd Feb | Bob | 500 | 1000 | 50% |
3rd Feb | Jessica | 600 | 1200 | 50% |
The reason I want a measure rather then a Column is so I can have a slider on the date so that if I was to change the date range to just 1st Feb and 2nd Feb as below, the Day % would change.
Table.Date | Table.Salesperson | Table.$ Amount | Measure.Total | Measure.Day % (Help) |
1st Feb | Bob | 200 | 500 | 40% |
1st Feb | Jessica | 200 | 600 | 33% |
2nd Feb | Bob | 300 | 1000 | 30% |
2nd Feb | Jessica | 400 | 1200 | 33% |
Any help would be greatly appreciated.
Thanks
Gritman
Solved! Go to Solution.
@gritman add following measures, Total Sales and % Sales
Total Sales = VAR __salesPerson = MAX( Table[Salesperson] ) RETURN CALCULATE(SUM(Table[$ Amount]), ALLSELECTED( Table ), Table[Table.Salesperson] = __salesPerson ) % Sales = DIVIDE( SUM( Table[$ Amount] ), [Total Measure] )
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@gritman add following measures, Total Sales and % Sales
Total Sales = VAR __salesPerson = MAX( Table[Salesperson] ) RETURN CALCULATE(SUM(Table[$ Amount]), ALLSELECTED( Table ), Table[Table.Salesperson] = __salesPerson ) % Sales = DIVIDE( SUM( Table[$ Amount] ), [Total Measure] )
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi Parry2k,
That worked! Many, many thanks.
Rgds
Gritman
User | Count |
---|---|
12 | |
12 | |
8 | |
8 | |
6 |
User | Count |
---|---|
27 | |
19 | |
13 | |
11 | |
7 |