Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Dear Community,
I am very new to power BI. This could be simple requirement but I am struggling to make it work.
Here is my requirement :
DAX to calculate dynamically within group.
Type | EMPLID | Calculation | expected result |
CTA | 1001 | distinct emplid/ count(type) | 0.33 |
Generic | 1001 | distinct emplid/ count(type) | 0.33 |
1001 | distinct emplid/ count(type) | 0.33 | |
XYZ | 1002 | distinct emplid/ count(type) | 1.00 |
I have Type slicer on the report page and when I select ex: Type ->CTA, Generic then expected result is
Type | EMPLID | Calculation | expected result |
CTA | 1001 | distinct emplid/ count(type) | 0.50 |
Generic | 1001 | distinct emplid/ count(type) | 0.50 |
1001 | distinct emplid/ count(type) | ||
XYZ | 1002 | distinct emplid/ count(type) |
Please help.
Thanks,
Solved! Go to Solution.
@vishwa_sg
measure = divide(distinctcount(emplid), calculate(distinctcount(type), allselected(type)))
@vishwa_sg Here is a link to download a sample solution file:
DAX to calculate dynamically within Selected Group 2022-08-10.pbix
Hi @SpartaBI Thank you so much.
By using your formula. I managed to achieve the expected result. Have to calculate within a group and here is the working DAX
@my pleasure 🙂
P.S. Check out my showcase report - got some high level stuff there. Sure you will find there a lot of cool ideas. Please give it a thumbs up over there if you liked it 🙂https://community.powerbi.com/t5/Data-Stories-Gallery/SpartaBI-Feat-Contoso-100K/td-p/2449543
@vishwa_sg
measure = divide(distinctcount(emplid), calculate(distinctcount(type), allselected(type)))
@vishwa_sg Here is a link to download a sample solution file:
DAX to calculate dynamically within Selected Group 2022-08-10.pbix
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
13 | |
11 | |
9 | |
6 |