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

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%

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
Community Support

I think you should create another measure to calculate percentage.

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

I think this is the result you want:

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.

5 REPLIES 5
Community Support

Please confirm whether this is the result you want?

``````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.

Administrator

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.

Best regards

Sebastian Hernandez

Community Support

I think you should create another measure to calculate percentage.

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

I think this is the result you want:

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.

Community Support

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:

Create following measures:

``````Count = COUNTROWS('Table')

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

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

There is no filtering:

Filter on this page:

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.

Administrator
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

#### Power BI Monthly Update - July 2024

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

#### Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors
Top Kudoed Authors