Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ChuckChuck2
New Member

Create a virtual "status" as a measure that is not aggregated

Hello. I need use a measue to assign a text value that will be displayed in a table visual. e.g., 

Status =
VAR _Status =
if( [Value 1st] > [Value 2nd], "Up", IF( [Value 1st] < [Value 2nd], "Down", "Flat"))
RETURN
_Status

 

This works as expected on the table on the left, but when I remove the customer, the table is aggregating by unique color "Black", but this is not what I want. I want to see Black continue to be listed for each "Status" (Up and Down). Please note, I cannot make the "Status" a calculated column because it will need to be dynamic based on slicer selections in the final version. 

2022-12-12_18-16-13.png

1 ACCEPTED SOLUTION
ChuckChuck2
New Member

I've figured out a solution. I've created a stand alone table with the possible status values and a generic key of "1". I then added a column to my fact table with a generic key of "1". In the model, I then join the table of possible status values to my fact table (with a bridge table between to avoid the many-to-many relationship). 


I then use a switch statement to test if the value is Up, Down, etc. and map the resulting value to the status table value using the Switch function.2022-12-13_8-20-27.png

View solution in original post

1 REPLY 1
ChuckChuck2
New Member

I've figured out a solution. I've created a stand alone table with the possible status values and a generic key of "1". I then added a column to my fact table with a generic key of "1". In the model, I then join the table of possible status values to my fact table (with a bridge table between to avoid the many-to-many relationship). 


I then use a switch statement to test if the value is Up, Down, etc. and map the resulting value to the status table value using the Switch function.2022-12-13_8-20-27.png

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.