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
Anonymous
Not applicable

Write measure that combines, ScaleValue slicer (ShowValueAs) and with Currency slicer

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?

6 REPLIES 6
Anonymous
Not applicable

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 .

 

 

Anonymous
Not applicable

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:

DAX: YTD and MTD questions

 

Regards,
Xiaoxin Sheng

Anonymous
Not applicable

Unfortunately, I get an error with the divide function:

 

Capture.PNG

Anonymous
Not applicable

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
)
 

 

Anonymous
Not applicable

HI @Anonymous,

 

Please share some sample file for test.

 

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

@Anonymous

 

I think your method is pretty solid. How did you calculate amount?

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors