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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
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.