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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
atul06
Microsoft Employee
Microsoft Employee

Need help to calculate % of view contributing 85%of total views per play

Hello ,

 

Below is Data 

 

PlayAreaPublishDateKeyIDContentViewsrank Cumulative Total Sumcummulative 85 Percflag(Cumulative <Total Sum per Play Area)
Accelerate 20250404123a14711473623081
Accelerate20250402124b6522123623081
Accelerate20250425125c5232643623081
Accelerate20250430126d3643003623081
Accelerate20250410127e3553353623080
Accelerate20250430128f2763623623080

 

 

Output Required 

 

Total FlagTotal Count% cost  contributing 85% of total cost  per Solution Area
4667%

 

Below Measures are created but its not working as expected

 

 

rank = ROWNUMBER(SUMMARIZE(ALLSELECTED(Play),
Play[PlayArea],Play[ID],"Sum_fin",[Total Content Views]),
ORDERBY([Sum_fin],DESC ),PARTITIONBY(Play[PlayArea]))
 
cumulative = 
VAR CurrentRank = [rank]
RETURN
    CALCULATE(
        SUM(Play[ContentViews]),
        FILTER(
            ALLSELECTED(Play),
            [rank] <= CurrentRank &&
            Play[PlayArea] = MAX(Play[PlayArea])
        )
    )
cummulative 85 Perc = 
VAR currentSolutionPlay = SELECTEDVALUE(Play[PlayArea])
VAR vTotalSP = CALCULATE(
    SUM(Play[ContentViews]),
    ALLSELECTED(Play),
    Play[PlayArea] = currentSolutionPlay 
)
VAR vTotalSP_85Per = vTotalSP 
RETURN
    vTotalSP_85Per*0.85
   
 Cumilativ flag = IF([cumulative]<[cummulative 85 Perc],1,0)
 
Cumulative flag is expanding rows, and its not giving correct results

 

 

 

12 REPLIES 12
v-sshirivolu
Community Support
Community Support

Hi @atul06 ,
Thanks for reaching out to the Microsoft fabric community forum.

Table name: Play

Step 1: Create Calculated Columns

1. RankPerPlayArea:
RANKX(
FILTER(Play, Play[PlayArea] = EARLIER(Play[PlayArea])),
Play[ContentViews],
,
DESC,
DENSE
)

2. CumulativeContentViews:
CALCULATE(
SUM(Play[ContentViews]),
FILTER(
Play,
Play[PlayArea] = EARLIER(Play[PlayArea]) &&
Play[RankPerPlayArea] <= EARLIER(Play[RankPerPlayArea])
)
)

3. Threshold85Percent:
CALCULATE(
SUM(Play[ContentViews]) * 0.85,
ALLEXCEPT(Play, Play[PlayArea])
)
\

4. CumulativeFlag:
IF(
Play[CumulativeContentViews] <= Play[Threshold85Percent],
1,
0
)

Step 2: Create Measures 

1. Total Flag:
CALCULATE(
COUNTROWS(Play),
Play[CumulativeFlag] = 1
)

2. Total Count:
COUNTROWS(Play)

3. % Contributing:
DIVIDE([Total Flag], [Total Count], 0)

Format this measure as Percentage.


Step 3: Visualize the Result

Create a Table visual or Cards:

Fields to Add:
PlayArea (Optional)
Total Flag
Total Count
% Contributing

Explanation of Each Component

RankPerPlayArea: Ranks rows by ContentViews within each PlayArea.
CumulativeContentViews: Adds up views row by row in descending order.
Threshold85Percent: 85% of total views per PlayArea.
CumulativeFlag: Marks rows that are part of first 85% contribution.
Measures: Aggregate totals and compute %.

Please find the below attached .pbix file for your reference.

If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it.

Best Regards,
Sreeteja.
Community Support Team 



Hi @atul06  , 

Just wanted to check if you had the opportunity to review the suggestion provided?

If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it.

Hi @atul06 ,

May I ask if you have resolved this issue? If so, please mark the helpful reply and Accept it as the solution and give a 'Kudos'. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you.

 

Ashish_Excel
Solution Supplier
Solution Supplier

Hi,

Download the PBI file from here.

Hope this helps.

Ashish_Excel_0-1749856880200.png

 

Hi @Ashish_Excel ,

 

Thanks for providng solution . When CV values are the same, the running total calculation becomes incorrect. Ranking should act like rownumber instead of dense rank dynamically

 

atul06_0-1749930071142.png

 

Hi @atul06  ,
Thanks for reaching out to the Microsoft fabric community forum.

Try these steps to Resolve.

Use ROW_NUMBER like behavior

Replace the current [rank] measure with one that creates a unique sequence number even for ties i.e., simulating ROW_NUMBER in DAX.

1. Create a Unique Row Nymber like Measure
RowNumber Measure =
RANKX(
FILTER(
ALLSELECTED(Play),
Play[PlayArea] = MAX(Play[PlayArea])
),
[ContentViews]*100000 + VALUE(MAX(Play[PublishDateKey])),
,
DESC,
Skip
)

2. Cumulative Views Based on RowNumber

CumulativeViews Measure =

VAR CurrentRow = [RowNumber Measure]
RETURN
CALCULATE(
SUM(Play[ContentViews]),
FILTER(
ALLSELECTED(Play),
Play[PlayArea] = MAX(Play[PlayArea]) &&
[RowNumber Measure] <= CurrentRow
)
)

3. Total Views Per PlayArea
TotalViews Measure =
CALCULATE(
SUM(Play[ContentViews]),
ALLEXCEPT(Play, Play[PlayArea])
)

4. 85% Threshold
Threshold85 Measure = [TotalViews Measure] * 0.85

5. Flag Rows Contributing to 85%

Flag85 Measure =
IF(
[CumulativeViews Measure] < [Threshold85 Measure],
1,
0
)

6. % of Rows That Contribute to 85%

PercentContributing Measure =
DIVIDE(
CALCULATE(SUMX(VALUES(Play[ID]), [Flag85 Measure])),
CALCULATE(DISTINCTCOUNT(Play[ID]))
)

 

Im Attaching the file below for your reference

 

If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it

Best Regards,
Sreeteja.
Community Support Team 

Hi @atul06 ,

May I ask if you have resolved this issue? If so, please mark the helpful reply and Accept it as the solution and give a 'Kudos'. This will be helpful for other community members who have similar problems to solve it faster.

No this is not working as expected

Hi @atul06 ,
Try these steps -
Create Calculated Columns -
RankPerPlayArea:
RankPerPlayArea = RANKX( FILTER(Play, Play[PlayArea] = EARLIER(Play[PlayArea])), Play[ContentViews], , DESC, DENSE )
CumulativeContentViews:
CumulativeContentViews =
CALCULATE(
SUM(Play[ContentViews]),
FILTER(
Play,
Play[PlayArea] = EARLIER(Play[PlayArea]) &&
Play[RankPerPlayArea] <= EARLIER(Play[RankPerPlayArea])
)
)

Threshold85:
Threshold85 =
CALCULATE(
SUM(Play[ContentViews]) * 0.85,
ALLEXCEPT(Play, Play[PlayArea])
)
CumulativeFlag:

CumulativeFlag =
IF(Play[CumulativeContentViews] <= Play[Threshold85], 1, 0)


Create These Measures for Summary Visual -

TotalFlag :
TotalFlag= CALCULATE(COUNTROWS(Play), Play[CumulativeFlag] = 1)

TotalCount:
TotalCount = COUNTROWS(Play)

%Contributing:
PercentContributing =
DIVIDE([TotalFlag], [TotalCount])

Format PercentContributing as a percentage to clearly showcase your results.

I've verified that the issue is resolved, as my current output aligns perfectly with your expected output.
Find the attached .pbix file for your reference.


ThxAlot
Super User
Super User

ThxAlot_0-1749846159703.png

 

Calculated columns are not necessary at all.

ThxAlot_1-1749846221473.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



atul06
Microsoft Employee
Microsoft Employee

I have tried this solution. Its not working 

Not surprised. For most rookies, it's even a challenge to copy an out-of-the-box solution to their own scenarios.



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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