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
LarsAustin
Helper I
Helper I

Not showing the Correct Subtotals

Hi,

 

I hope you can help me with this issue. The problems may look pretty simple but I just cannot make it work. 


I wrote this DAX code:

 

=

VAR _Company = IF(HASONEVALUE(Inventory[Company]), VALUES(Inventory[Company]))
VAR _ValueInAUD = SUMX(VALUES('Item'[Item No.]),[Inventory To Date ($)] * [AU FX Rate])

VAR _Result = IF(_Company = "AU" , [Inventory To Date ($)],_ValueInAUD)

RETURN

_Result

 

The problem is that on an item level, I am getting the correct result. But the total on Inventory To Date ($ AUD) is not correct. $292,404 + $32,215 = $324,719, not $303,812.

LarsAustin_2-1683774874138.png

 

 

I think $303,812 is result of $292,404 multiplied by the AU FX rate (0.9285) plus $32,315. But I don't like to convert $292,404 since this is already in AUD (the company is AU).

I've tried a modifications in my code but i just cannot get to my desired output.

 

Appreciate your help in advance.

 

Thanks

 

Jojemar

 

 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Try

My Measure =
SUMX (
    VALUES ( Inventory[Company] ),
    VAR _ValueInAUD =
        SUMX ( VALUES ( 'Item'[Item No.] ), [Inventory To Date ($)] * [AU FX Rate] )
    VAR _Result =
        IF ( Inventory[Company] = "AU", [Inventory To Date ($)], _ValueInAUD )
    RETURN
        _Result
)

View solution in original post

2 REPLIES 2
LarsAustin
Helper I
Helper I

Thank you so much @johnt75 ..

 

Your formula works perfectly.

johnt75
Super User
Super User

Try

My Measure =
SUMX (
    VALUES ( Inventory[Company] ),
    VAR _ValueInAUD =
        SUMX ( VALUES ( 'Item'[Item No.] ), [Inventory To Date ($)] * [AU FX Rate] )
    VAR _Result =
        IF ( Inventory[Company] = "AU", [Inventory To Date ($)], _ValueInAUD )
    RETURN
        _Result
)

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.