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.
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 |
---|---|
16 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
23 | |
13 | |
13 | |
8 | |
8 |