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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Dax topN to percentage

im trying to convert  a set of values derrived from ranking to there equivilant percentage.

 

the schema is as follows 

Social Network CM Red Social Users CM Red Social
(not set)100
Academia454
Buzzfeed235
Facebook676
Youtube33
Instagram67
Meetup56
Twitter345
(not set)234
Academia546
Buzzfeed676
Facebook87
Youtube89
Instagram76
Meetup45
Twitter78

 

i have one mesure that filters out a social network not needed and aggregates a total

 

Users CM Red Social Total = SUMX(FILTER('Grupo LD CM Red Social','Grupo LD CM Red Social'[Social Network CM Red Social] <> "(not set)"),'Grupo LD CM Red Social'[Users CM Red Social])

 

with this measure in hand i have another measure that ranks and gets the top 5 social media users

 

TopNRedSocial = if ( RANKX(all('Grupo LD CM Red Social'[Social Network CM Red Social]),CALCULATE([Users CM Red Social Total])) < 6,sum('Grupo LD CM Red Social'[Users CM Red Social]),BLANK())

 

how can i convert this to percentage knowing that the order and names can change dfrom day to day 

 

im thinking i can use the divide feature with a ranking to 5 and filter out the unwanted social media 

 

below is my current result i need that in percentage 

2019-10-16 16_36_04-LD Grupo - Power BI Desktop.png

thanks 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

fixed with the below

TopNRedSocial =
IF (
(RANKX (
ALL ( 'Grupo LD CM Red Social'[Social Network CM Red Social]),
CALCULATE ( [Users CM Red Social Total] ),6,DESC
) < 6),
'Grupo LD CM Red Social'[Users CM Red Social Total]
/ CALCULATE (
SUMX (FILTER('Grupo LD CM Red Social','Grupo LD CM Red Social'[Social Network CM Red Social] <> "(not set)"), 'Grupo LD CM Red Social'[Users CM Red Social] ),
ALL ( 'Grupo LD CM Red Social' )
),
BLANK()
)
2019-10-21 13_39_42-LD Grupo - Power BI Desktop.png

View solution in original post

4 REPLIES 4
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

You may modify the measaure as below:

TopNRedSocial =
IF (
    RANKX (
        ALL ( 'Grupo LD CM Red Social'[Social Network CM Red Social ] ),
        CALCULATE ( [Users CM Red Social Total] )
    ) < 6,
    SUM ( 'Grupo LD CM Red Social'[Users CM Red Social] )
        / CALCULATE (
            SUM ( 'Grupo LD CM Red Social'[Users CM Red Social] ),
            ALL ( 'Grupo LD CM Red Social' )
        ),
    BLANK ()
)

Community Support Team _ Jimmy Tao

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

Anonymous
Not applicable

2019-10-18 10_32_05-LD Grupo - Power BI Desktop.png

that gives me a percentage based on all the catagories including the ones not shown.

 

Anonymous
Not applicable

i changed the mesure to below 

 

TopNRedSocial =
IF (
RANKX (
ALL ( 'Grupo LD CM Red Social'[Social Network CM Red Social]),
CALCULATE ( [Users CM Red Social Total] )
) < 6,
SUM ( 'Grupo LD CM Red Social'[Users CM Red Social] )
/ CALCULATE (
SUMX (FILTER('Grupo LD CM Red Social','Grupo LD CM Red Social'[Social Network CM Red Social] <> "(not set)"), 'Grupo LD CM Red Social'[Users CM Red Social] ),
ALL ( 'Grupo LD CM Red Social' )
),
BLANK ()
)
 
its almost correct variance of 1 percent im guessing its tolarable
2019-10-18 10_40_37-LD Grupo - Power BI Desktop.png
Anonymous
Not applicable

fixed with the below

TopNRedSocial =
IF (
(RANKX (
ALL ( 'Grupo LD CM Red Social'[Social Network CM Red Social]),
CALCULATE ( [Users CM Red Social Total] ),6,DESC
) < 6),
'Grupo LD CM Red Social'[Users CM Red Social Total]
/ CALCULATE (
SUMX (FILTER('Grupo LD CM Red Social','Grupo LD CM Red Social'[Social Network CM Red Social] <> "(not set)"), 'Grupo LD CM Red Social'[Users CM Red Social] ),
ALL ( 'Grupo LD CM Red Social' )
),
BLANK()
)
2019-10-21 13_39_42-LD Grupo - Power BI Desktop.png

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.