Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
I am working with a survey in which each respondent answers multiple times on multiple days. I'm not sure if my problem would be better solved using a different data model or if it's measures.
I have sample data provided - each person mentions their three favorite colors each day. I need to be able to see all possible colors a person might like if they like x color on x day. I will need this to go back and forth, too. If a person liked x color on the last day, what did they like before, etc.
I've tried measures and have been working to find an "in" type solution similar to SQL, but so far, when I filter down to a specific color/day combination, it's filtering out all the other possiblities. It's like I need it to filter back up, but can't get that to work quite right.
Here are some screen shots to explan better ("PROVIDED" highlighted yelllow is current format of data before I transform in Power BI):
Expected results (existing table uses (x, x, x) format
Unpivoted data in Power BI
Name | Colors |
Joe | (Red, Yellow) |
Joe | (Blue, Purple) |
Joe | (Yellow, Red) |
Dan | (Red, Blue) |
Dan | (Blue, Purple) |
Dan | (Green, Red) |
Mary | (Yellow, Red) |
Mary | (Green, Green) |
Mary | (Red, Yellow) |
Name | day | color |
Joe | Monday | Red |
Joe | Tuesday | Yellow |
Joe | Monday | Blue |
Joe | Tuesday | Purple |
Joe | Monday | Yellow |
Joe | Tuesday | Red |
Dan | Monday | Red |
Dan | Tuesday | Red |
Dan | Monday | Blue |
Dan | Tuesday | Purple |
Dan | Monday | Green |
Dan | Tuesday | Red |
Mary | Monday | Yellow |
Mary | Tuesday | Red |
Mary | Monday | Green |
Mary | Tuesday | Green |
Mary | Monday | Red |
Mary | Tuesday | Yellow |
Solved! Go to Solution.
Hi @jschembre ,
Create two disconnected tables with the days and the colors then add the following measure:
Preidction =
VAR selectedLines =
FILTER (
GROUPBY ( ALLSELECTED ( 'Table' ), 'Table'[color], 'Table'[Name], 'Table'[day] ),
'Table'[day] = SELECTEDVALUE ( 'Weekday'[WeekDay] )
&& 'Table'[color] = SELECTEDVALUE ( 'Color Slicer'[Color] )
)
VAR Selectpersons =
SELECTCOLUMNS ( selectedLines, "Persons", 'Table'[Name] )
RETURN
COUNTROWS ( FILTER ( 'Table', 'Table'[Name] IN Selectpersons ) )
Result below and in attach PBIX file.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @jschembre ,
Create two disconnected tables with the days and the colors then add the following measure:
Preidction =
VAR selectedLines =
FILTER (
GROUPBY ( ALLSELECTED ( 'Table' ), 'Table'[color], 'Table'[Name], 'Table'[day] ),
'Table'[day] = SELECTEDVALUE ( 'Weekday'[WeekDay] )
&& 'Table'[color] = SELECTEDVALUE ( 'Color Slicer'[Color] )
)
VAR Selectpersons =
SELECTCOLUMNS ( selectedLines, "Persons", 'Table'[Name] )
RETURN
COUNTROWS ( FILTER ( 'Table', 'Table'[Name] IN Selectpersons ) )
Result below and in attach PBIX file.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThank you so much!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
86 | |
71 | |
66 | |
50 | |
29 |
User | Count |
---|---|
118 | |
100 | |
73 | |
65 | |
40 |