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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
rile14
Helper I
Helper I

Data Bars in a table not working with created measure

Hi All,

 

I have a slicer where I can select between Imperial and Metric values. Currently I have area values in the table displayed without sqm/sqft, just pure numbers. I have created this measure in order to get sqm/sqft displayed together with those amounts from the column:

 

Area =
    IF(SELECTEDVALUE('Slicer Imperial Metric System'[Measurement]) in {"Imperial"},
    FORMAT([Total Leasable Area], SWITCH(SELECTEDVALUE('Slicer Imperial Metric System'[Measurement]),"Imperial", "#,##0sqft;(#,##0)sqft")),
    FORMAT([Total Leasable Area], SWITCH(SELECTEDVALUE('Slicer Imperial Metric System'[Measurement]),"Metric", "#,##0sqm;(#,##0)sqm"))
)
 
With this measure i'm getting desired output, but the issue is that i'm now not able to get data bars displayed.
rile14_0-1637795862981.png

 

Does anyone know what is the issue here? Is the above dax correct?
Just to point out that data type is defined as a decimal number.
Thanks in advance.
3 REPLIES 3
AlexisOlson
Super User
Super User

Yeah, data bars aren't going to work with text output. Luckily, you can keep the measure a numeric data type and still set a custom format for it.

 

In the Model pane select the measure and set Format to custom and set the format string here:

AlexisOlson_1-1637800704310.png

I used this format string:

 

#,0\s\q\m

 

 

AlexisOlson_0-1637800608980.png

 

Thanks for your response @AlexisOlson 

I assume you didn't apply this format to my measure, but on a clean number field?

When I try to use this custom format with my measure from above, it doesn't work. 

 

If I apply this format to a measure that is showing just a number, then it works, but it's not what I need.

I need this to be dynamic, so when I select 'Imperial' from the slicer I expect to see SQFT and when I select 'Metric' I expect to see SQM. Because of that I created a measure that I written above.

 

Does it mean that it's not possible to have data bars withs such measure?

 

Thanks.

That's correct. I applied it to a clean number field.

 

It's a bit trickier if you need multiple custom formats but I was able to do leveraging the Format String Expression within a calculation group.

AlexisOlson_0-1637955921174.png

 

AlexisOlson_1-1637955952110.png

 

AlexisOlson_2-1637955974999.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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