Forum Discussion
Similar Excel Subtotal function in DAX with Calculated Column or another route?
Hi somtom ,
Please create a new table:
Category = {">=70%","50%-70%","Under 50%"}Then create these measures:
Full Cost per City = CALCULATE ( SUM ( 'Sample'[Full Cost] ), FILTER ( ALLSELECTED ( 'Sample' ), 'Sample'[City] = MAX ( 'Sample'[City] ) ) )Full Working Cost per City = CALCULATE ( SUM ( 'Sample'[Working Cost] ), FILTER ( ALLSELECTED ( 'Sample' ), 'Sample'[City] = MAX ( 'Sample'[City] ) ) )Working per Full = [Full Working Cost per City] / [Full Cost per City]Ratio Category = IF ( [Working per Full] >= 0.7, ">=70%", IF ( [Working per Full] >= 0.5, "50%-70%", "Under 50%" ) )CountCity = CALCULATE ( DISTINCTCOUNT ( 'Sample'[City] ), FILTER ( VALUES ( 'Sample'[City] ), [Ratio Category] = MAX ( Category[Value] ) ) )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,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- v-kkf-msftCommunity Support
Hi somtom ,
Please create a new table:
Category = {">=70%","50%-70%","Under 50%"}Then create these measures:
Full Cost per City = CALCULATE ( SUM ( 'Sample'[Full Cost] ), FILTER ( ALLSELECTED ( 'Sample' ), 'Sample'[City] = MAX ( 'Sample'[City] ) ) )Full Working Cost per City = CALCULATE ( SUM ( 'Sample'[Working Cost] ), FILTER ( ALLSELECTED ( 'Sample' ), 'Sample'[City] = MAX ( 'Sample'[City] ) ) )Working per Full = [Full Working Cost per City] / [Full Cost per City]Ratio Category = IF ( [Working per Full] >= 0.7, ">=70%", IF ( [Working per Full] >= 0.5, "50%-70%", "Under 50%" ) )CountCity = CALCULATE ( DISTINCTCOUNT ( 'Sample'[City] ), FILTER ( VALUES ( 'Sample'[City] ), [Ratio Category] = MAX ( Category[Value] ) ) )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,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. - Ashish_MathurSuper User
Hi,
Share the link from where i can download your PBI file.
- somtomNew Member
I accepted your solution. I'm very thankful. I thougt just it. I applied the solution route in my real, more-more comlex issue, and it is working well 🙂