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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

how to get variance of selected measures from the slicers

Hey guys

Really want to explain straight - i have a slicer you can multi-select existing measures 
suppose slicer is
* measure1 
* measure2
* measure3 

table shows how many measure is selected. Works fine ! 

user wants to see select two measures, and bring me those two measure's difference
suppose selected measures
* measure1
* measure2

expected view in the columns
measure1 | measure2 | (measure1-measure2) |

       5        |        3        |                  2               |
and records below..

please any ideas?
thanks!
 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

I suggest you to create two unrelated measure name tables to help calculation.

The code of "Measure Name" and "Measure selection" calculated tables are the same.

Measure Name = 
DATATABLE (
    "Measure", STRING,
    "Sort", INTEGER,
    {
        { "Measure1", 1 },
        { "Measure2", 2 },
        { "Measure3", 3 }
    }
)

Data model:

vrzhoumsft_0-1685346855342.png

Measure Combine = 
VAR _COMBINE =
    ADDCOLUMNS (
        'Measure Name',
        "switch",
            SWITCH (
                'Measure Name'[Measure],
                "Measure1", [Measure1],
                "Measure2", [Measure2],
                "Measure3", [Measure3]
            )
    )
VAR _LEFT =
    SUMX ( FILTER ( _COMBINE, [Sort] = MIN ( 'Measure Selection'[Sort] ) ), [switch] )
VAR _RIGHT =
    SUMX ( FILTER ( _COMBINE, [Sort] = MAX ( 'Measure Selection'[Sort] ) ), [switch] )
RETURN
    IF (
        ISFILTERED ( 'Measure Selection'[Measure] ),
        IF (
            HASONEVALUE ( 'Measure Name'[Measure] ),
            SUMX (
                FILTER (
                    _COMBINE,
                    'Measure Name'[Measure] IN VALUES ( 'Measure Selection'[Measure] )
                ),
                [switch]
            ),
            _LEFT - _RIGHT
        ),
        "Please select two measures to compare"
    )

Result is as below.

vrzhoumsft_1-1685346985500.png

vrzhoumsft_2-1685346992335.png

 

Best Regards,
Rico Zhou

 

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

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@Anonymous 
it works perfect except once you select three values it's calculation three of them and we don't want that
 5| 3| 6 = -1 which I couldn't even find summarizing out of {5,3,6} 

Anonymous
Not applicable

Hi @Anonymous ,

 

I suggest you to create two unrelated measure name tables to help calculation.

The code of "Measure Name" and "Measure selection" calculated tables are the same.

Measure Name = 
DATATABLE (
    "Measure", STRING,
    "Sort", INTEGER,
    {
        { "Measure1", 1 },
        { "Measure2", 2 },
        { "Measure3", 3 }
    }
)

Data model:

vrzhoumsft_0-1685346855342.png

Measure Combine = 
VAR _COMBINE =
    ADDCOLUMNS (
        'Measure Name',
        "switch",
            SWITCH (
                'Measure Name'[Measure],
                "Measure1", [Measure1],
                "Measure2", [Measure2],
                "Measure3", [Measure3]
            )
    )
VAR _LEFT =
    SUMX ( FILTER ( _COMBINE, [Sort] = MIN ( 'Measure Selection'[Sort] ) ), [switch] )
VAR _RIGHT =
    SUMX ( FILTER ( _COMBINE, [Sort] = MAX ( 'Measure Selection'[Sort] ) ), [switch] )
RETURN
    IF (
        ISFILTERED ( 'Measure Selection'[Measure] ),
        IF (
            HASONEVALUE ( 'Measure Name'[Measure] ),
            SUMX (
                FILTER (
                    _COMBINE,
                    'Measure Name'[Measure] IN VALUES ( 'Measure Selection'[Measure] )
                ),
                [switch]
            ),
            _LEFT - _RIGHT
        ),
        "Please select two measures to compare"
    )

Result is as below.

vrzhoumsft_1-1685346985500.png

vrzhoumsft_2-1685346992335.png

 

Best Regards,
Rico Zhou

 

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

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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