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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

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
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Power BI Header Change

Power BI Header Update

Read about the exciting updates for the Power BI forum.