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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Aishu_2609
New Member

Show different Values (Average / SUM) in single bar graph based on selected slicer option

Dear Team,

 

I want to show the average of some values and sum of some values based upon the selected slicer option. Say for example, if we have a table A which has columns named products, months, country  and sales value. Products column had books and phones. If user selects books the value should be shown as average of Sales Value  column  keeping months, country constant (same as FIXED function in tableau) and if user selects phones sum of sales value should be shown keeping months, country constant.

Your support is appreciated.

thanks

1 ACCEPTED SOLUTION

Hi, @Aishu_2609

Books and phones are the contents of the "Products" field where I group them in the formula.

If the results are incorrect, please share sample data and expected results for further research.

Best Regards,
Community Support Team _ Eason

View solution in original post

4 REPLIES 4
Aishu_2609
New Member

@v-easonf-msft Manny thanks for this , can you kindly confirm if I can use Msales as a slicer and slicer will show books and phones as 2 options to select?

Hi, @Aishu_2609

Books and phones are the contents of the "Products" field where I group them in the formula.

If the results are incorrect, please share sample data and expected results for further research.

Best Regards,
Community Support Team _ Eason

Many Thanks 

v-easonf-msft
Community Support
Community Support

Hi,  @Aishu_2609 

Please try measure like blow:

 

M_Sales =
SWITCH (
    SELECTEDVALUE ( 'Table'[Products] ),
    "Books",
        CALCULATE (
            AVERAGE ( 'Table'[sales] ),
            FILTER (
                ALL ( 'Table' ),
                'Table'[country] = MAX ( 'Table'[country] )
                    && 'Table'[Products] = MAX ( 'Table'[Products] )
            )
        ),
    "Phones",
        CALCULATE (
            SUM ( 'Table'[sales] ),
            FILTER (
                ALL ( 'Table' ),
                'Table'[country] = MAX ( 'Table'[country] )
                    && 'Table'[Products] = MAX ( 'Table'[Products] )
            )
        )
)

 

Best Regards,
Community Support Team _ Eason

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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