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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
ChristofferSN
Frequent Visitor

Calculated column used for benchmarking ignoring filter/slicer

Hey all! 

I want to calculate a column I can use for benchmarking. The column should be untouched by my Branch filter if a branch is chosen in a slicer.

 

In my report I'm showing the distribution of already calculated categorical column 'Filters'[NpsType] (see picture):

ChristofferSN_1-1671707331914.png

 

If a branch manger then want to see the distribution for his branch he can use a slicer, but then I want to use a second column for benchmarking, and add to the visualization, but if he does not choose to look at any branches it should be blank. I have tried to calculate a new column with following function: 

NPSType_BM =
IF (
ISFILTERED ( 'Filters'[Branchname] ),
ALL ( 'Filters'[NpsType] ),
BLANK ()
)

Thx in advance,

 

Best Christoffer

 




1 ACCEPTED SOLUTION

If you provide example data or an example file, it is much easier to help. Here is a good guide on how to ask for help: How to Get Your Question Answered Quickly

I have created this model:

sturlaws_0-1671832608847.png

 

Then create these measures

Scores =
VAR _type =
    SELECTEDVALUE ( NPS[NPS] )
RETURN
    DIVIDE (
        SWITCH (
            TRUE (),
            _type = "promoters",
                CALCULATE (
                    COUNT ( 'ScoreTable'[id] ),
                    FILTER ( 'ScoreTable', 'ScoreTable'[score] >= 8 )
                ),
            _type = "detractors",
                CALCULATE (
                    COUNT ( 'ScoreTable'[id] ),
                    FILTER ( 'ScoreTable', 'ScoreTable'[score] <= 6 )
                ),
            CALCULATE (
                COUNT ( 'ScoreTable'[id] ),
                FILTER ( 'ScoreTable', 'ScoreTable'[score] > 6 && 'ScoreTable'[score] < 8 )
            )
        ),
        COUNT ( 'ScoreTable'[id] )
    )

 

Scores all branches =
IF (
    ISFILTERED ( BranchTable ),
    CALCULATE ( [Scores], ALL ( 'BranchTable' ) ),
    BLANK ()
)

 

sturlaws_1-1671832829836.png

sturlaws_2-1671833132526.png

 

 

file is available in the bottom of this post

 

 

 

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

Share some data and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
sturlaws
Resident Rockstar
Resident Rockstar

Hi, @ChristofferSN,

 

why do you want a column, could you do it by a measure like this:

MeasureBenchmark =
IF (
    ISFILTERED ( 'Table'[Branch] ),
    CALCULATE ( AVERAGE ( 'Table'[ValueCol] ), ALL ( 'Table'[Branch] ) ),
    BLANK ()
)

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

 

How to Get Your Question Answered Quickly

Thanks for the reply @sturlaws,

It don't necessarily have to be a new calculated column, if a measure can do the trick.

Nonetheless, in your formula you are using average, but the column 'Table' [value column] is a categorical TEXT column, and therefor it doesn't work. Which function should I use instead?

If you provide example data or an example file, it is much easier to help. Here is a good guide on how to ask for help: How to Get Your Question Answered Quickly

I have created this model:

sturlaws_0-1671832608847.png

 

Then create these measures

Scores =
VAR _type =
    SELECTEDVALUE ( NPS[NPS] )
RETURN
    DIVIDE (
        SWITCH (
            TRUE (),
            _type = "promoters",
                CALCULATE (
                    COUNT ( 'ScoreTable'[id] ),
                    FILTER ( 'ScoreTable', 'ScoreTable'[score] >= 8 )
                ),
            _type = "detractors",
                CALCULATE (
                    COUNT ( 'ScoreTable'[id] ),
                    FILTER ( 'ScoreTable', 'ScoreTable'[score] <= 6 )
                ),
            CALCULATE (
                COUNT ( 'ScoreTable'[id] ),
                FILTER ( 'ScoreTable', 'ScoreTable'[score] > 6 && 'ScoreTable'[score] < 8 )
            )
        ),
        COUNT ( 'ScoreTable'[id] )
    )

 

Scores all branches =
IF (
    ISFILTERED ( BranchTable ),
    CALCULATE ( [Scores], ALL ( 'BranchTable' ) ),
    BLANK ()
)

 

sturlaws_1-1671832829836.png

sturlaws_2-1671833132526.png

 

 

file is available in the bottom of this post

 

 

 

Thank you!  @sturlaws 

It works now

I have tried with 

NPSType_BM =
VAR NpsType =
    IF (
        'Wilke Filters'[NPS] > 8,
        "Promoters",
        IF ( 'Wilke Filters'[NPS] > 6, "Passives", "Detractors" )
    )
RETURN
    IF (
        ISFILTERED ( 'Wilke Filters'[afdelingsNavn] ),
        CALCULATE (
            COUNTAX ( 'Wilke Filters', NpsType ),
            ALL ( 'Wilke Filters'[NpsType] )
        ),
        BLANK ()
    )

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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