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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
user2023
Regular Visitor

Transform SQL to DAX

I'm new to Powerbi, and I'm having trouble converting this SQL code to DAX
measure: perc_ating {
label: "∆ % Monthly Goal"
type: number
sql: case when
${perc_ating_aux} >= 0 then ${perc_ating_aux}
else 100 end
;;
value_format: "#.0\%"
}.
Can anybody help me

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@user2023 This would be easier with sample data and expected output but maybe try:

perc_ating measure = IF( [perc_ating_aux] >= 0, [perc_ating_aux], 100)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler But how would I put the value format "#.0\%" for it to come within this condition?

@user2023 Either @R1k91 's method or you can use a Custom Format String. Use custom format strings in Power BI Desktop - Power BI | Microsoft Learn. You could use FORMAT but that will turn it into text.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

couldn't you simply use format pane for that measure?

 

R1k91_0-1681999204574.png

 


--
Riccardo Perico
BI Architect @ Lucient Italia | Microsoft MVP

Blog | GitHub

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.