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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. 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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

March Power BI Update Carousel

Power BI Community Update - March 2026

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