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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
eliasayyy
Memorable Member
Memorable Member

Dynamic Format Data Labels in charts

hello everyone , 
i have a facebook ads by campaign table

Campaign            Impressions
Camp A1500000
Camp B100500
Camp C1000
Camp D10000


i want to make a  column chart that will show me the campaign in the x-axis and measure of Total impressions
Total impressions = sum(table[impressions])

when i turn on data labels , i want to show a dynamic data label

so if number is in millions it will return 1.00M if the numbe rin thousands then it will return 1.00k

so new format should be i will show in table for better context

Campaign          Impressions
Camp A1.5M
Camp B100.5k
Camp C1.00K
Camp D10.00K




1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@eliasayyy , Try like

 

SWITCH ( TRUE() ,
[Impressions]>= 1000000000 , FORMAT ([Impressions]/1000000000, decimal) & "bn" ,
[Impressions]>= 1000000, FORMAT ([Impressions]/1000000, decimal) & "M" ,

[Impressions]>= 1000, FORMAT ([Impressions]/1000, decimal) & "K",
FORMAT ([Impressions] , decimal)
)

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@eliasayyy , Try like

 

SWITCH ( TRUE() ,
[Impressions]>= 1000000000 , FORMAT ([Impressions]/1000000000, decimal) & "bn" ,
[Impressions]>= 1000000, FORMAT ([Impressions]/1000000, decimal) & "M" ,

[Impressions]>= 1000, FORMAT ([Impressions]/1000, decimal) & "K",
FORMAT ([Impressions] , decimal)
)

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Actually with the dynamic formating you don't need to use division.

 

SWITCH(TRUE(),
ABS([val]) >= 1000000, "\$#,0,,.0M;(\$#,0,,.0M)"
ABS([val]) > 100000,"$#,0,.0k;($#,0,.0k)"
,"#,0;(#,0)")
 
I have noticed with trying to get K to work without a decimal using, 
"\$#,0,.k;(\$#,0,.k)" the values that appear in the data label is not correct but the value shown in tables and in the tool tip is corrrect.  I have no Idea why but if someone knows a solution please let me know.  
 
Jack 
 

  

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (3,855)