Forum Discussion
Blank First Row When Calculating Running Percentage
Hello Everyone,
I've successfully formulated a running percentage measure that uses the following two measures:
Incorrect Calculation for Plant 2:
Furthermore, if I filter by dates, some dates work, others don't.
I can't figure out why the slicers being applied only work for certain filtered criteria.
Thank you for any assistance provided.
Best,
Michael
9 Replies
- lbendlin
Super User
Please provide sanitized sample data that fully covers your issue. Paste the data into a table in your post or use one of the file services. Please show the expected outcome.
- MStP
Helper I
Hello,
Please see the sample file attached. Everything works as expected here - I can't replicate the issue.
https://drive.google.com/file/d/15m14GMW5a312fHtXG4JQkiUY9bqFTc7a/view?usp=sharing
- v-kkf-msft
Community Support
Hi MStP ,
I made some changes based on Jihwan_Kim's formula and replaced "ALL" in the formula with "ALLSELECT". Please try the following formula to see if it works.
Sales: = SUM( Data[Sales] )Sales percentage: = var allsales = CALCULATE( [Sales:], ALLSELECTED(Data)) return DIVIDE( [Sales:], allsales )Sales percentage cumulate: = VAR current_row_percentage = [Sales percentage:] VAR percentagetable_by_vendors = FILTER ( ADDCOLUMNS ( ALLSELECTED(Data[Vendors]), "@salespercentage", [Sales percentage:] ), [@salespercentage] >= current_row_percentage ) RETURN SUMX ( percentagetable_by_vendors, [@salespercentage] )If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
WinnizIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- MStP
Helper I
Hi Winniz,
I had previously changed the formula to ALLSELECTED and that is producing the results screen captured in my original post. I have included a file link to sample data in my other reply - I'm not sure how to get the same kind of download link you provided. It looks like I need special permission.
Moreover, I'm not experiencing errors in the DAX so there is no error information, just inconsistent application of the formula depending on the plant/date selected.
Michael
- v-kkf-msft
Community Support
Hi MStP ,
Please try this measure to see if it meets your data.
Measure = var sum_cumulate = CALCULATE( SUM(Data[Sales]), FILTER( ALLSELECTED(Vendors), Vendors[Vendors] <= MAX(Vendors[Vendors]) ) ) var sum_total = SUMX( ALLSELECTED(Data), Data[Sales] ) return IF( SUM(Data[Sales]) <> BLANK(), sum_cumulate / sum_total )If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
WinnizIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.