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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
mhablas426
Advocate II
Advocate II

Dynamic Format values

Dears
I would like to complete that format to include minus signs in front of negative values.
the expected result to be (-1.2m) ,(-12.5K)
Thanks,
DAX format I used:

IF (
    [Samperiodlast year Variance] >= 1000000,
    "0,,.00 M",
    IF ( [Samperiodlast year Variance] >= 1000, "0,.00 K", "0.00" )
)


Screenshot 2024-07-07 133916.jpg

 

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@mhablas426 , Try this measure

FormattedFuelQuantity =
VAR Quantity = 'Fuel Formulas'[Fuel Total Quantity]
RETURN
IF (
Quantity >= 1000000,
FORMAT(Quantity, "0,,.00 M"),
IF (
Quantity >= 1000,
FORMAT(Quantity, "0,.00 K"),
IF (
Quantity <= -1000000,
FORMAT(Quantity, "0,,.00 M"),
IF (
Quantity <= -1000,
FORMAT(Quantity, "0,.00 K"),
FORMAT(Quantity, "0.00")
)
)
)
)

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

5 REPLIES 5
bhanu_gautam
Super User
Super User

@mhablas426 , Try this measure

FormattedFuelQuantity =
VAR Quantity = 'Fuel Formulas'[Fuel Total Quantity]
RETURN
IF (
Quantity >= 1000000,
FORMAT(Quantity, "0,,.00 M"),
IF (
Quantity >= 1000,
FORMAT(Quantity, "0,.00 K"),
IF (
Quantity <= -1000000,
FORMAT(Quantity, "0,,.00 M"),
IF (
Quantity <= -1000,
FORMAT(Quantity, "0,.00 K"),
FORMAT(Quantity, "0.00")
)
)
)
)

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






mhablas426
Advocate II
Advocate II

I got those errors, could you assist, please 
Pic 1Pic 1

 

Pic 2Pic 2

 

rajendraongole1
Super User
Super User

Hi @mhablas426 - Can you try the below measure to report the expected result with () for negative

 

Formatted Value =
VAR Value = [Samperiodlast year Variance]
RETURN
IF(
ABS(Value) >= 1000000,
IF(Value < 0,
"-" & FORMAT(ABS(Value) / 1000000, "0.0") & "m",
FORMAT(Value / 1000000, "0.0") & "m"
),
IF(
ABS(Value) >= 1000,
IF(Value < 0,
"-" & FORMAT(ABS(Value) / 1000, "0.0") & "K",
FORMAT(Value / 1000, "0.0") & "K"
),
FORMAT(Value, "0.00")
)
)

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





foodd
Super User
Super User

Hello @mhablas426, and thank you for sharing you question with members of the Community Forum who are supportive.   Remember to adhere to the decorum of the Community Forum when asking a question.

Please provide your work-in-progress Power BI Desktop file (with sensitive information removed) that covers your issue or question completely in a usable format (not as a screenshot).

https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

This allows members of the Forum to assess the state of the model, report layer, relationships, and any DAX applied.

 

If your requirement is solved, please make THIS ANSWER a SOLUTION ✔️ and help other users find the solution quickly. Please hit the LIKE 👍 button if this comment helps you.  Proud to be a Super User!

Thanks, I have re-edited my message to be clear

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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