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
Anonymous
Not applicable

Dynamically Change Format In Visual

I'm confused on how to use best practices with a slicer.   I want the users to essentially be able to choose Units or Sales in a slicer where Key is selected for Slicer.   This would then flow thru to a visual that would be a bar chart with a yoy line.   I can create the yoy measure for both, so thats not the issue.   However, the problem I'm having is that sales is in dollars and units is not.  I have my data structured like this:

 

CompanyDateKeyValue
Company ANov-19Sales$12.50
Company ADec-19Sales$15.50
Company ANov-19Units2
Company ADec-19Units4
Company BNov-19Sales$20.50
Company BDec-19Sales$25.00
Company BNov-19Units4
Company BDec-19Units5

 

Is it really not possible to dynamically change the format in a visual?  

 

Has this been solved? 

https://community.powerbi.com/t5/Desktop/Dynamically-format-a-measure-as-or/td-p/157192

 

Thank you in advance

5 REPLIES 5
parry2k
Super User
Super User

@Anonymous you can sure use but it will be string

 

Sum = 
VAR __selectedValue = SELECTEDVALUE ( Table[Key] )
VAR __sum = SUM ( Table[Value] )
RETURN
IF ( __selectedValue = "Units", FORMAT( __sum, "General Number" ), 
FORMAT ( __sum, "Currency" 
)

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

thank you - but as you mentioned it is a string, so you can only put it in a tooltip.  

 

So does this mean there is no way to dynamically change the format in a visual?   

 

And if not, can we remove the Value from the tooltip so all it sees is the string?

 

 

@Anonymous correct, you cannot use it in visual like bar chart etc but you can surely use it in Card Visual, Yes you can use it in tooltip, and to remove actual value from tooltip, you can create custom tooltip page that allows you to choose whatever you want to show on tooltip



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

that's crazy you can't dynamically change formatting on a visual.  such a basic feature.  thanks though.

Hi @Anonymous ,

 

I sincerely invite you to submit your idea if you want:

https://ideas.powerbi.com/.

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

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.

Top Solution Authors