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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
CiaranC
Frequent Visitor

Can't create a static measure.

I have a Dashboard where I display population. I can select small population areas from a slicer, map visual or stacked bar chart and other visuals update to reflect these selections.

 

I am trying to get a card to update with the selected small percentage areas as a percentage of grand total when they are selected on either the map visual or stacked bar chart. I can get a measure to work with a slicer, but I can't get this to work when I select small areas using other visuals. I either get an error or 100%

  

I was going down two paths and neither seem to work no matter what I try or what I find for similar issues online. 

 

1. Create a static measure with the sum of population that doesn't change when items in visuals are selected. 

2. Allow me to create a measure that I can divide the total by only items selected. 

 

Any ideas or suggestions to point me in the right direction would be most helpful. 

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

Hi @CiaranC ,

I create a table as you mentioned.

vyilongmsft_0-1717120915154.png

Then I create a measure and here is the DAX code.

Percent =
CALCULATE ( SUM ( 'Table'[Population] ) )
    / CALCULATE ( SUM ( 'Table'[Population] ), ALLSELECTED ( 'Table' ) )

I add a slicer and I can use it in any visual.

vyilongmsft_1-1717121101427.png

 

 

 

Best Regards

Yilong 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

3 REPLIES 3
v-yilong-msft
Community Support
Community Support

Hi @CiaranC ,

I create a table as you mentioned.

vyilongmsft_0-1717120915154.png

Then I create a measure and here is the DAX code.

Percent =
CALCULATE ( SUM ( 'Table'[Population] ) )
    / CALCULATE ( SUM ( 'Table'[Population] ), ALLSELECTED ( 'Table' ) )

I add a slicer and I can use it in any visual.

vyilongmsft_1-1717121101427.png

 

 

 

Best Regards

Yilong Zhou

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

 

Thanks Yilong. Good to get this solution but could get this working with a slicer but not by using a visual. I did get a solution using two different measures, one to select all small areas and the second to only bring back data from areas selected on visual. 

Population All Areas Selected = CALCULATE([# Population total], ALL('2022_Data'[Small Areas]))
% Population All Areas Selected = DIVIDE([# Population total],[# Population All Areas Selected])
CiaranC
Frequent Visitor

Got this working from the stacked bar chart but can't get it working from map visual. Doesn't seem to filter through the stacked bar chart visual.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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