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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
chinni611
Frequent Visitor

Ignore Slicer selections for one bar in stacked bar chart

Hi , 

I am trying to ignore a slicer selections for one bar in a graph which shows the national average. 

I created a table and measure and created relationship by which i am able to get the avg into the field . 

Here is the dax measure below which is not working . Please help 

I need the avg to be shown in the X axis along with territory , It is showing currently , when i select area or region it disappears

 

 Avg Terr = VAR _selected = SELECTEDVALUE(Territory[TERR_NAME])

VAR _result = IF(

    _selected = "Avg.",CALCULATE(AVERAGEX(SUMMARIZE('Lookup_Table','Lookup_Table'[Use Case],"toAverage",[Suggestions_SalesAlert]),[Suggestions_SalesAlert]), ALLEXCEPT('terr_hier_ csv','terr_hier_ csv '[Area]),

        USERELATIONSHIP('terr_hier_csv'[TERR_NAME],Territory[TERR_NAME])),

    CALCULATE(AVERAGEX(SUMMARIZE('Lookup_Table','Lookup_Table'[Use Case Latest],"toAverage",[Suggestions_SalesAlert]),[Suggestions_SalesAlert]),

           Territory[TERR_NAME] = _selected)

)

RETURN _result

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @chinni611 ,

The problem seems to be related to the interaction between slicers and visuals. When you select an area or region, the measure behaves unexpectedly.

To achieve your goal, consider creating an unrelated table that lists all available city names. This way, when you choose any value from the slicer, the table visual won’t be filtered by it.

You can also try this DAX:

// Measure to always show national average
National_Avg = CALCULATE(
    AVERAGEX(SUMMARIZE('Lookup_Table', 'Lookup_Table'[Use Case], "toAverage", [Suggestions_SalesAlert]), [Suggestions_SalesAlert]),
    ALL('terr_hier_csv')
)

// Measure that responds to slicer selections
Selected_Territory_Avg = CALCULATE(
    AVERAGEX(SUMMARIZE('Lookup_Table', 'Lookup_Table'[Use Case Latest], "toAverage", [Suggestions_SalesAlert]), [Suggestions_SalesAlert]),
    Territory[TERR_NAME] = _selected
)

Best Regards,

Xianda Tang

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

1 REPLY 1
Anonymous
Not applicable

Hi @chinni611 ,

The problem seems to be related to the interaction between slicers and visuals. When you select an area or region, the measure behaves unexpectedly.

To achieve your goal, consider creating an unrelated table that lists all available city names. This way, when you choose any value from the slicer, the table visual won’t be filtered by it.

You can also try this DAX:

// Measure to always show national average
National_Avg = CALCULATE(
    AVERAGEX(SUMMARIZE('Lookup_Table', 'Lookup_Table'[Use Case], "toAverage", [Suggestions_SalesAlert]), [Suggestions_SalesAlert]),
    ALL('terr_hier_csv')
)

// Measure that responds to slicer selections
Selected_Territory_Avg = CALCULATE(
    AVERAGEX(SUMMARIZE('Lookup_Table', 'Lookup_Table'[Use Case Latest], "toAverage", [Suggestions_SalesAlert]), [Suggestions_SalesAlert]),
    Territory[TERR_NAME] = _selected
)

Best Regards,

Xianda Tang

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

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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