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

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Kudoed Authors