Skip to main content
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

Frequent Visitor

Using Switch or IF statement with measure not providing expected results

Trying to create a simple measure that displays a comment for a value generated by a measure. The measure calculates a variance number from actual vs. goal. The variance measure is calculating correctly. However, when I try to use IF or Switch functions to show a text comment based on the variance measure's value (number <0 = "Hours are under goal"), the results delivered are not consistent. In some cases the results are as expected but in others there are not. The dashboard shows variances for different relative date periods (month-to-date, year-to-date).


The DAX code is noted below.


Hours_Goal_Comment = SWITCH(TRUE(),[Hours_vs_Goal]<0,"Hours under goal",[Hours_vs_Goal]>0,"Hours exceed goal")

There are other measures used to calculate the Hours_vs_Goal measure so not sure if these are causing the issue. Also tired IF statements and got the same results. Any thoughts on why this is happening would be very helpful.

Frequent Visitor

Problem solved. Thanks.

Hi @bmauro,


If you share your solution here I think it will be help for others who faced the similar issues.



XIaoxin sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

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.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

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.