Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hi,
I have been working to try and come up with a calculated column that can tell me if my list of locations meets a specific condition with a Yes/No statement.
I have a list of locatins with a column of different tickets. The locations are listed more than once but can have two different types of tickets. I am trying to group the locations to say if Location has a PSU and a Non NWR Ticket, "Yes", if not then "No". The calculation column it tried using below as well as several other attempts but it seems i'm not fully understanding how to achieve it.
Below is the sample data
https://1drv.ms/u/s!AqID1H0nHPOzhAoeXiSYdvCbmb-e?e=4iU40P
Attached is an example snip from excel of what I am getting at
I appreciate the support and any input I can get.
Thank you
Solved! Go to Solution.
Here is a column expression that shows one way to do it.
Has Both =
VAR vResult =
CALCULATE (
DISTINCTCOUNT ( 'Sample'[Ticket] ),
ALLEXCEPT ( 'Sample', 'Sample'[Location] ),
'Sample'[Ticket] IN { "PSU", "Non NWR" }
)
RETURN
IF ( vResult = 2, "Y", "N" )
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Here's a faster version that does not rely on CALCULATE:
// T is the name of your table.
[Your Column] = // calculated column
var CurrentLocation = T[Location]
var TicketTable = {"psu", "non nwr"}
var Yes =
2 = COUNTROWS(
filter(
ALL( T[Location], T[Ticket] ),
T[Location] = CurrentLocation
&&
T[Ticket] in TicketTable
)
)
return
if( Yes, "Yes", "No" )
@mahoneypat & @Anonymous thank you both for the solution. Not that I would have figured out the entire equation but I did not stop to think of using VAR. Thank you.
Here is a column expression that shows one way to do it.
Has Both =
VAR vResult =
CALCULATE (
DISTINCTCOUNT ( 'Sample'[Ticket] ),
ALLEXCEPT ( 'Sample', 'Sample'[Location] ),
'Sample'[Ticket] IN { "PSU", "Non NWR" }
)
RETURN
IF ( vResult = 2, "Y", "N" )
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Here's a faster version that does not rely on CALCULATE:
// T is the name of your table.
[Your Column] = // calculated column
var CurrentLocation = T[Location]
var TicketTable = {"psu", "non nwr"}
var Yes =
2 = COUNTROWS(
filter(
ALL( T[Location], T[Ticket] ),
T[Location] = CurrentLocation
&&
T[Ticket] in TicketTable
)
)
return
if( Yes, "Yes", "No" )
User | Count |
---|---|
77 | |
75 | |
67 | |
65 | |
47 |
User | Count |
---|---|
108 | |
105 | |
93 | |
83 | |
65 |