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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
Anonymous
Not applicable

Switch true with multiple data types

Hi all,

 

I have a switch true query that returns whole numbers, decimals numbers and currency. This is causing issues with data formatting in the visuals and tooltips. They are all defaulting to 2 decimal places.

 

When hovering over the data I'd like the pop up to show the data as formatted in the measure howeverI'm unsure what the best way to deal with this is.

 

 

6 REPLIES 6
Anonymous
Not applicable

Hi, @Anonymous 

I don't really get what you mean by "switch true query". Could you clarify the code or your situation, maybe some screen shots?

 

Thank you

Paul,
Best

Anonymous
Not applicable

Hi Paul,

 

It is a switch formula which links to different reports. Similar to the below:

 

Column 2 = 

SWITCH(TRUE(),

   Dates[Date]>01/01/2007 && Dates[Date]<08/30/2008,"2007/2008",

   Dates[Date]>08/31/2008 && Dates[Date]<08/30/2009,"2008/2009",

   Dates[Date]>08/31/2009 && Dates[Date]<08/30/2010,"2009/2010",

   Dates[Date]>08/31/2010 && Dates[Date]<08/30/2011,"2010/2011)

Anonymous
Not applicable

Hi, mish

I have made some tests with the switch true function using a random sample, however it does not appear to have the decimal issue like you do. Maybe you can have a look at the data types of the used columns, and the decimal format underneath. 

Best,
Paul

Anonymous
Not applicable

Hi Paul,

 

The data I provided was sample data, however imagine one data source was currency and one was volume. That is where the issue lies - PowerBI does not format the data based on its source. And if you try to add a format function, it switches to text which is useless with bar graphs. Unfortunately I do not believe there is a way to do what I wanted, yet.

 

Thank you.

Anonymous
Not applicable

Hi,

 

you colud try setting your measure as text and formatting values into the switch functions

 

Regards

Lorenzo

Anonymous
Not applicable

Unfortunately the data is presented as a graph so text wouldn't work. It seems currently there just isn't a way to do this?

Helpful resources

Announcements
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.