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
anwar_b_uk
Frequent Visitor

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

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

@anwar_b_uk ,

 

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.

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.

 

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

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