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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Syndicate_Admin
Administrator
Administrator

Calculation of dynamic percentages subject to the segmenter

Good afternoon

I am looking for help to solve the following difficulty: I have a board on which I am placing the main characteristics of the profile of a student group from a sample of several regions of my country. The board makes use of the cards as a display. The difficulty I have is that this information must be presented as percentages of the total sample and then filtered by each of the regions from which the information was obtained.

*First use a measure to count the information:

Count = COUNTROWS(Undergraduate)
*Second, use another measure to count the total information:
Total count 2 = CALCULATE([Count],ALLSELECTED())
*Al final divided both measures:
% = DIVIDE([Count],[Total count 2])
When I mount the information in a table the result is as expected, but when I do it on a card the result is always 100%
Juances_17_0-1669405522806.png
Juances_17_2-1669406000762.png

I ask for your help to guide me and tell me what alternatives I have to be able to identify the main characteristics of the student group once the information is filtered.

1 ACCEPTED SOLUTION

Hi @Syndicate_Admin ,

 

I think you should create another measure to calculate percentage.

% 2 = DIVIDE ( [Count], [Total count 2] )

 

I think this is the result you want:

vyadongfmsft_0-1669775066817.png

Best regards,

Yadong Fang

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

5 REPLIES 5
v-yadongf-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

 

Please confirm whether this is the result you want?

vyadongfmsft_0-1669685487561.png

 

Count = COUNTROWS('Table')

Total count 2 = CALCULATE([Count],ALLEXCEPT('Table','Table'[Region]))

% = 
IF (
    ISINSCOPE ( 'Table'[School] ),
    DIVIDE ( [Count], [Total count 2] ),
    DIVIDE ( [Total count 2], CALCULATE ( [Count], ALL ( 'Table' ) ) )
)

 

 

Best regards,

Yadong Fang

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

Good morning

First thank you for the help you are giving me. The result I am waiting for is not that. When I apply a filter to the visual, the expected result is the percentage of the filtered feature.

For this example the result that the card should show is the percentage (participation) of the female gender 65.38%, instead of 0.22%, since what I need to calculate is the participation on my new totality that for this case is 26.

Juances_17_0-1669730349883.png

Best regards

Sebastian Hernandez

Hi @Syndicate_Admin ,

 

I think you should create another measure to calculate percentage.

% 2 = DIVIDE ( [Count], [Total count 2] )

 

I think this is the result you want:

vyadongfmsft_0-1669775066817.png

Best regards,

Yadong Fang

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

 

 

 

v-yadongf-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

 

ALLSELECTED( ) removes context filters from columns and rows in the current query, while retaining all other context filters or explicit filters. Please refer to:ALLSELECTED function (DAX) - DAX | Microsoft Learn

 

You can use ALL( ) instead of ALLSELECTED( ).

 

This is my test table:

vyadongfmsft_0-1669606368513.png

 

Create following measures:

 

Count = COUNTROWS('Table')

Total count 2 = CALCULATE([Count],ALL('Table'))

% = DIVIDE([Count],[Total count 2])

 

 

There is no filtering:

vyadongfmsft_1-1669606415298.png

 

Filter on this page:

vyadongfmsft_2-1669606472111.png

 

Best regards,

Yadong Fang

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

Good afternoon, I appreciate the help provided, however, with the suggested solution the expected result is partially obtained, since when I use a segmenter, the result obtained in Total Count 2 is always the totality of the sample, and when filtering with a segmenter I need that value obtained to be my new total on which to calculate the participation.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.