Forum Discussion

BlueAndOrange24's avatar
BlueAndOrange24
Frequent Visitor
2 years ago
Solved

Summarize based on slicer selections that have difference measures

My scenario is I have a slicer that references a table for regions. There is a separate table that lists values for both a budget cost amount and an actual cost amount per region.
 
If the region slicer is equal to "unallocated" I want the result to display the actual cost amount which varies from month to month.
 
If the region is not equal to "unallocated" then I want the fixed budget amount to display. 
 
The issue I'm having a hard time accounting for in the measure is if any combination of unallocated and non uanllocated are selected. When this happens I want the summary to display budget and actuals based on the slicer options selected using the scenarios above. Right now its all defaulting to the budget value. My formula is below along with the sample slider options.
 
Delivered & Planned =
VAR slicer = SELECTEDVALUE(T_NewPlatformList[Allocation])
RETURN if([Actual Value $] > [Budget Value $] && al = "Unallocated", [Actual Value $], [Budget Value $])
 
Region
Americas
South America
EMEA
Unallocated
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi, BlueAndOrange24 

    First, I've created the following sample data:

    To simulate the situation, I've created the following two measures:

    Actual Value $ = SUM('Values'[Actual Value $1])
    Budget Value $ = SUM('Values'[Budget Value $1])

    As you described, you can create a measure with your DAX expression to switch individual measures based on the slicer, but when you select Unallocated and any other region, you want to display both the Actual Value $ and Budget Value $ measures.
    This is displayed directly through the measure and is not currently supported.
    Here's a better way to deal with this mix.

    With the above two metrics in place, I create a field parameter:

    Add these two measures to the field parameter:

    We get a table of parameter:

    We need to add the region to this table and modify the DAX expression as follows:

    Parameter = 
    {
        ("Actual Value $", NAMEOF('Values'[Actual Value $]), 0,"Unallocated"),
        ("Budget Value $", NAMEOF('Values'[Budget Value $]), 1,"Americas"),
        ("Budget Value $", NAMEOF('Values'[Budget Value $]), 1,"EMEA"),
        ("Budget Value $", NAMEOF('Values'[Budget Value $]), 1,"South America")
    }
    

    Let's build a slicer with the value4 column:

    Use the Parameter column and the Region and Month columns in the values table to build a table visual:

    The result is as follows:
    When I select not equal to unallocated in the slicer, Budget Value $ is displayed.

     


    When I select equal to unallocated displays Actual Value $ .

     


    Budget Value $ and Actual Value $ are displayed when I select any combination of unallocated and other regions.

    If you also want to filter out the region of the table by slicer, you can create a new measure:

    Is seleted region? = 
    VAR _current_region = VALUES(Parameter[Value4])
    RETURN IF(SELECTEDVALUE('Values'[Region]) IN _current_region,1,0)

    Place this measure at the visual level in the filter panel and set it to a value of 1:

    I've provided the PBIX file used this time below.

     

     

    Best Regards

    Jianpeng Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

     

     

     

     

     

     

     

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, BlueAndOrange24 

    First, I've created the following sample data:

    To simulate the situation, I've created the following two measures:

    Actual Value $ = SUM('Values'[Actual Value $1])
    Budget Value $ = SUM('Values'[Budget Value $1])

    As you described, you can create a measure with your DAX expression to switch individual measures based on the slicer, but when you select Unallocated and any other region, you want to display both the Actual Value $ and Budget Value $ measures.
    This is displayed directly through the measure and is not currently supported.
    Here's a better way to deal with this mix.

    With the above two metrics in place, I create a field parameter:

    Add these two measures to the field parameter:

    We get a table of parameter:

    We need to add the region to this table and modify the DAX expression as follows:

    Parameter = 
    {
        ("Actual Value $", NAMEOF('Values'[Actual Value $]), 0,"Unallocated"),
        ("Budget Value $", NAMEOF('Values'[Budget Value $]), 1,"Americas"),
        ("Budget Value $", NAMEOF('Values'[Budget Value $]), 1,"EMEA"),
        ("Budget Value $", NAMEOF('Values'[Budget Value $]), 1,"South America")
    }
    

    Let's build a slicer with the value4 column:

    Use the Parameter column and the Region and Month columns in the values table to build a table visual:

    The result is as follows:
    When I select not equal to unallocated in the slicer, Budget Value $ is displayed.

     


    When I select equal to unallocated displays Actual Value $ .

     


    Budget Value $ and Actual Value $ are displayed when I select any combination of unallocated and other regions.

    If you also want to filter out the region of the table by slicer, you can create a new measure:

    Is seleted region? = 
    VAR _current_region = VALUES(Parameter[Value4])
    RETURN IF(SELECTEDVALUE('Values'[Region]) IN _current_region,1,0)

    Place this measure at the visual level in the filter panel and set it to a value of 1:

    I've provided the PBIX file used this time below.

     

     

    Best Regards

    Jianpeng Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.