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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Aamir_khan
Advocate V
Advocate V

How to show aggregate value by filtering 2 country and show as total in bar including 2 country

Hi All

 

can we have feature where the graph can be selected. For e.g- when we select Australia and Canada, there's a bar that aggregate the 2 countriesonaly on the graph. And if I add France as well to the filter, the aggregate bar changes to average of 3.

 

How can we do that. I have attached the pbix file "Pbix Sample  ". can you please help me on that.
Screenshot 2023-01-11 220257.png

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Aamir_khan ,

I created some data:

vyangliumsft_0-1673513404289.png

Here are the steps you can follow:

1. Create calculated table.

Table 2 =
var _Column={"Total"}
return
UNION(
    DISTINCT('Table'[Country]),_Column)

vyangliumsft_1-1673513404289.png

2. Create measure.

Measure =
var _select=SELECTCOLUMNS('Table',"1",[Country])
return
SUMX(ALLSELECTED('Table'),[Amount])
Value =
IF(
    MAX('Table 2'[Country]) ="Total",
    [Measure],
    SUMX(
        FILTER('Table',
        'Table'[Country]=MAX('Table 2'[Country])),[Amount])
    )

3. Result:

vyangliumsft_2-1673513404293.png

 

Best Regards,

Liu Yang

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

6 REPLIES 6
Aamir_khan
Advocate V
Advocate V

Thanks

v-yangliu-msft
Community Support
Community Support

Hi  @Aamir_khan ,

I created some data:

vyangliumsft_0-1673513404289.png

Here are the steps you can follow:

1. Create calculated table.

Table 2 =
var _Column={"Total"}
return
UNION(
    DISTINCT('Table'[Country]),_Column)

vyangliumsft_1-1673513404289.png

2. Create measure.

Measure =
var _select=SELECTCOLUMNS('Table',"1",[Country])
return
SUMX(ALLSELECTED('Table'),[Amount])
Value =
IF(
    MAX('Table 2'[Country]) ="Total",
    [Measure],
    SUMX(
        FILTER('Table',
        'Table'[Country]=MAX('Table 2'[Country])),[Amount])
    )

3. Result:

vyangliumsft_2-1673513404293.png

 

Best Regards,

Liu Yang

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

v-yangliu-msft
Community Support
Community Support

Hi  @Aamir_khan ,

I created some data:

vyangliumsft_0-1673505810516.png

Here are the steps you can follow:

1. Create measure.

Measure =
var _select=SELECTCOLUMNS('Table',"1",[Country])
return
SUMX(ALLSELECTED('Table'),[Amount])

2. Result:

vyangliumsft_1-1673505810523.png

Does it meet your expected results

 

Best Regards,

Liu Yang

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

Hi Liu Yang

Thanks for helping me but I want separate dynamic bar for the Total based on filtre selection. Means when i select 2 country from filter then dynamic bar bar that aggregate the 2 countriesonaly on the graph
Capture.PNG

Aamir_khan
Advocate V
Advocate V

Any solution on above query 

Aamir_khan
Advocate V
Advocate V

Hi All

How can we do that. I have attached the pbix file "Pbix Sample  ". can you please help me on that on above query.

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.