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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
GSntna
Regular Visitor

SWITCH Satement not returning values

Hi,

I have the following table in my model:

GSntna_0-1685559798805.png

I created a measure to return a given string depending on the value of the GL Account column. Here's the (modified, easier to replicate) code.

 

 

 

 

 

Actuals USD = 
SWITCH(FIRSTNONBLANK(M_Consol_Pnl[GL Account], M_Consol_Pnl[GL Account]),
"HW Revenue", [Total System Revenue],
"HW Margin", [Total System CM],
"HW Margin %", [Total System CM %],
"Supp Revenue", [Total System Revenue],
"Supp Margin", [Total System Revenue],
"Supp Margin %", [Total System Revenue],
"Serv & Supp Rev", [Total System Revenue],
"Serv & Supp Margin", [Total System Revenue],
"Serv & Supp Margin %", [Total System Revenue],
"SW & Soltions Rev", [Total System Revenue],
"SW & Solutions Margin", [Total System Revenue],
"SW & Solutions Margin %", [Total System Revenue],
"Total System Rev", [Total System Revenue],
"Total System Margin", [Total System Revenue],
"Total System Margin %", [Total System Revenue],
BLANK()
)

 

 

 

 

 

The measures being returned for each of the switch cases are all done the following way:

 

 

 

 

Total System Revenue = CALCULATE(SUM(Source_PnL[Amount]),Source_PnL[GL_Account]="Total Revenue")

 

 

 

 

This is basically a sumif function, the only part that would change would be the Source_PnL[GL_Account]="Total Revenue" part.

 

The problem is that when I create the visual, it appears that some values aren't returned randomly; I say randomly because the measure POR USD was created in the exact same way but it returns information from another table and it shows random rows only. 

GSntna_2-1685560966697.png

I created all of this about two months ago and what's weird is that it all worked perfectly back then. Do you know if there was a Power BI update that might've affected the formula? Is there something I should change?

 

 

0 REPLIES 0

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.