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.
Hi, I am a newbie in Power Bi and face a problem in evaluating a column. Please see below sample
Account | Deployment |
Company1 | WFH |
Company1 | Office |
Company2 | WFH |
Company3 | Office |
I'd like to create 3 new column/measure that I can use for the Slicer Visual
1. Showing the accounts that have WFH Deployment only
2. Showing the accounts that have Office Deployment only
3. Showing the accounts that have both Office and WFH deployment
Solved! Go to Solution.
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
Deployment measure: =
VAR newtable =
SUMMARIZE (
ADDCOLUMNS (
VALUES ( Data[Account] ),
"@result",
CALCULATE (
SWITCH (
SELECTEDVALUE ( Slicer[Index], 3 ),
1,
CALCULATE (
SELECTEDVALUE ( Data[Account] ),
Data[Deployment] = "WFH"
&& DISTINCTCOUNT ( Data[Deployment] ) = 1
),
2,
CALCULATE (
SELECTEDVALUE ( Data[Account] ),
Data[Deployment] = "Office"
&& DISTINCTCOUNT ( Data[Deployment] ) = 1
),
3,
CALCULATE (
SELECTEDVALUE ( Data[Account] ),
Data[Deployment]
IN { "WFH", "Office" }
&& DISTINCTCOUNT ( Data[Deployment] ) = 2
)
)
)
),
[@result]
)
RETURN
CONCATENATEX ( newtable, [@result] )
Hi,
For a more efficient way here is how to do this with just one measure:
End result (not selecting anything is the case 3.):
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
Proud to be a Super User!
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
Deployment measure: =
VAR newtable =
SUMMARIZE (
ADDCOLUMNS (
VALUES ( Data[Account] ),
"@result",
CALCULATE (
SWITCH (
SELECTEDVALUE ( Slicer[Index], 3 ),
1,
CALCULATE (
SELECTEDVALUE ( Data[Account] ),
Data[Deployment] = "WFH"
&& DISTINCTCOUNT ( Data[Deployment] ) = 1
),
2,
CALCULATE (
SELECTEDVALUE ( Data[Account] ),
Data[Deployment] = "Office"
&& DISTINCTCOUNT ( Data[Deployment] ) = 1
),
3,
CALCULATE (
SELECTEDVALUE ( Data[Account] ),
Data[Deployment]
IN { "WFH", "Office" }
&& DISTINCTCOUNT ( Data[Deployment] ) = 2
)
)
)
),
[@result]
)
RETURN
CONCATENATEX ( newtable, [@result] )
Hi Jihwan,
I appreciate your solution on this. I just want to ask if is it possible to use a table instead of a card for the list of accounts? I have more accounts to display and I also want my report to be interactive.
Thank you!
User | Count |
---|---|
28 | |
11 | |
8 | |
6 | |
5 |
User | Count |
---|---|
35 | |
14 | |
12 | |
9 | |
7 |