Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I am not sure how to most effectively write a DAX measure for "amount" that takes both a Scaled value slicer and a currency slicer into account.
SCALE-Table :
SHOW VALUE AS DividedBy
Real Value 1
Thousands 1000
Millions 1000000
Currency-Table
CURRENCY
LCY
DKK
I have create a measure that takes the scaled value into account:
IF ( HASONEVALUE ( Scale[DividedBy] ), DIVIDE (sum('SalesTrans'[Amount]), VALUES ( Scale[DividedBy] ) ) , sum('SalesTrans'[Amount]) )
And a measure that takes currency into account:
IF ( HASONEVALUE ( 'Currency'[Currency] ), SWITCH ( TRUE (), VALUES ( 'Currency'[Currency] ) = "DKK", // If no value set 0 sum('SalesTrans'[Amount]), VALUES ( 'Currency'[Currency] ) = "LCY", sum(SalesTrans[Amount]) ), // Default Value sum(SalesTrans[Amount]) )
How can i most effectively write these measure into one?
If any of the value in the currency or scaled slicer has been selected, I want to show DKK and Real Value as default 🙂
Can anyone help?
Now, i have created a measure based on the onther measure in this way:
IF ( HASONEVALUE ( Scale[DividedBy] ), DIVIDE ( [Amount], VALUES ( Scale[DividedBy] ) ) , [Amount] )
Is this best practices?
Later on, I would like to create a parameter thats hold the different periods, e.g. YTD, YTD LY, FY YTD etc.
as described here: http://www.daxpatterns.com/parameter-table/#skip-to-period-table .
Hi @Anonymous,
You can try to use below to merge these measure to one:
dynamic result=
var selected=IF ( HASONEVALUE ( Scale[DividedBy] ), VALUES ( Scale[DividedBy] ),BLANK() )
var result= DIVIDE (sum('SalesTrans'[Amount]), selected, sum('SalesTrans'[Amount]))
return
IF (HASONEVALUE ( 'Currency'[Currency] ), SWITCH ( max('Currency'[Currency]),"DKK", max(0,result),"LCY",result), result)
>>Later on, I would like to create a parameter thats hold the different periods, e.g. YTD, YTD LY, FY YTD etc.
If you share more detail informations, it will help to writing formula.
In addition, you can also take a look at below link:
Regards,
Xiaoxin Sheng
Unfortunately, I get an error with the divide function:
I have tried duing this, but this is not working either:
// Parent-child hierarchy VAR BrowseDepth = ISFILTERED (Org[Level 1]) + ISFILTERED (Org[Level 2]) + ISFILTERED (Org[Level 3]) + ISFILTERED (Org[Level 4]) + ISFILTERED (Org[Level 6]) // Currency parameter/slicer VAR AmountXX = IF ( HASONEVALUE ( Currency[Currency] ), SWITCH ( TRUE (), VALUES ( Currency[Currency] ) = "DKK", sum(GLTransaction[Amount DKK])*-1, VALUES ( Currency[Currency] ) = "LCY", sum(GLTransaction[Amount LCY])*-1 ), // Default Value sum(GLTransaction[Amount DKK])*-1 ) // ShowValueAs parameter/slicer VAR Amount = IF ( HASONEVALUE ( Scale[DividedBy] ), DIVIDE ( [AmountXX], VALUES ( Scale[DividedBy] ) ) , [AmountXX] ) RETURN //Ensure correct browsing of parent-chrild hierarchy IF ( MAX(Org[OrgNodeLenght]) >= BrowseDepth, Amount*-1 )
// Parent-child hierarchy
VAR BrowseDepth =
ISFILTERED (Org[Level 1]) +
ISFILTERED (Org[Level 2]) +
ISFILTERED (Org[Level 3]) +
ISFILTERED (Org[Level 4]) +
ISFILTERED (Org[Level 6])
// Currency parameter/slicer
VAR AmountXX =
IF (
HASONEVALUE ( Currency[Currency] ),
SWITCH (
TRUE (),
VALUES ( Currency[Currency] ) = "DKK", sum(GLTransaction[Amount DKK])*-1,
VALUES ( Currency[Currency] ) = "LCY", sum(GLTransaction[Amount LCY])*-1
),
// Default Value
sum(GLTransaction[Amount DKK])*-1
)
// ShowValueAs parameter/slicer
VAR Amount =
IF (
HASONEVALUE ( Scale[DividedBy] ),
DIVIDE ( [AmountXX], VALUES ( Scale[DividedBy] ) )
, [AmountXX]
)
RETURN
//Ensure correct browsing of parent-chrild hierarchy
IF (
MAX(Org[OrgNodeLenght]) >= BrowseDepth,
Amount*-1
)
HI @Anonymous,
Please share some sample file for test.
Regards,
Xiaoxin Sheng
@Anonymous
I think your method is pretty solid. How did you calculate amount?
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!