Forum Discussion

Mariollo's avatar
Mariollo
Helper I
1 year ago
Solved

Toggle between absolute values and % - using field parameters

I have a table like below:

 

 


I would like to use field parameters to toggle between absolute and % values to have second view like below:

 


For first values I have simple DAX measure

Absolute = COUNT ( Table[product_id] )
 
How can I have % values?
 
 

 

 

 
 

 

 

6 Replies

  • Hi Mariollo 

    You can remove the filter using the Calculate function

    Absolute % =

    COUNT ( Table[product_id] )

    /

    Calculate( COUNT ( Table[product_id] ), AllSelected(Table[range_column]))

     

     

    • Mariollo's avatar
      Mariollo
      Helper I

      Thank you, this is also working 🙂

       
       

       

       

  • ajohnso2's avatar
    ajohnso2
    Solution Supplier

    If you have access to the model you could create a static table via 'Enter Data'.

    Lets call the table 'Display Mask'

    Add a column and name it 'Display'

    Add a value 'Absolute'

    Add another value '%'

    Save and exit power query to apply the changes.

     

    You should have 2 measures already created (if not you should do this first)

    1 measure will hold the Absolute value

    the other measure in %

     

    You will then create a new measure, lets call it 'User Preference' and define it as below.

     

    User Preference = 

    VAR _SelectedDisplay = SELECTEDVALUE('Display Mask'[Display],"Absolute") (Default selection will be abs if nothing selected)

    VAR _Abs = [Absolute Value]

    VAR _% = [% Value]

     

    RETURN

    SWITCH(

    TRUE(),

    _SelectedDisplay = "Absolute", _Abs,

    _SelectedDisplay = "%", _%

    )

     

     

    N.B Be sure to drop the column from your new table into your report as a slicer