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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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