Forum Discussion

GSntna's avatar
GSntna
Regular Visitor
3 years ago

SWITCH Satement not returning values

Hi,

I have the following table in my model:

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. 

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?

 

 

No RepliesBe the first to reply