Forum Discussion
How should i be doing this to develop the visualization?
- 8 years ago
In your scenario, each of the columns from Account till Description can be the filter for your table. And you want to calculate the Cost1% or Cost2% based on these filters. Right?
If so, you can refer to following method:
You can use DAX expression like below to calculate the total count of table rows.
Total Account = CALCULATE(COUNTROWS('Cost Percent'),ALLSELECTED('Cost Percent'))Also use expression like this to calculate the count of each Split values.
CALCULATE(COUNTROWS('Cost Percent'),ALLSELECTED('Cost Percent'),VALUES('Cost Percent'[Split]))Then you can combine the two expression with Divide() function to calculae the Cost % like
Cost % = DIVIDE ( CALCULATE ( COUNTROWS ( 'Cost Percent' ), ALLSELECTED ( 'Cost Percent' ), VALUES ( 'Cost Percent'[Split] ) ), CALCULATE ( COUNTROWS ( 'Cost Percent' ), ALLSELECTED ( 'Cost Percent' ) ) )The result show like this:
Thanks,
Xi Jin. - 8 years ago
v-xjiin-msft Thanks a lot for your insights, this is working perfectly as needed.
In your scenario, each of the columns from Account till Description can be the filter for your table. And you want to calculate the Cost1% or Cost2% based on these filters. Right?
If so, you can refer to following method:
You can use DAX expression like below to calculate the total count of table rows.
Total Account = CALCULATE(COUNTROWS('Cost Percent'),ALLSELECTED('Cost Percent'))Also use expression like this to calculate the count of each Split values.
CALCULATE(COUNTROWS('Cost Percent'),ALLSELECTED('Cost Percent'),VALUES('Cost Percent'[Split]))Then you can combine the two expression with Divide() function to calculae the Cost % like
Cost % =
DIVIDE (
CALCULATE (
COUNTROWS ( 'Cost Percent' ),
ALLSELECTED ( 'Cost Percent' ),
VALUES ( 'Cost Percent'[Split] )
),
CALCULATE ( COUNTROWS ( 'Cost Percent' ), ALLSELECTED ( 'Cost Percent' ) )
)The result show like this:
Thanks,
Xi Jin.
v-xjiin-msft Thanks a lot for your insights, this is working perfectly as needed.