Forum Discussion
Ratio
Hey Guys !
I'm trying to display a metric showing a ration. For example assume we have fields such as Active - Innactive - Completed - Cancelled - Finished.
my objective is to display finsihed/Active - Innactive - Completed - Cancelled.
How can I do that on power bi desktop ?
many thanks in advance !
5 Replies
- dk_dkSuper User
Hi H_Kar ,
Assuming your data looks like this:You can write the following measure to calculate the ratio:
Ratio = VAR finished = CALCULATE(COUNTROWS('Table'),'Table'[status]="Finished") VAR other = CALCULATE(COUNTROWS('Table'),'Table'[status] IN {"Inactive","Cancelled","Active","Completed"}) RETURN DIVIDE(finished,other,0)Here I assumed that you want to calculate finished to all other statuses. If you want to calculate Active minus inactive minus completed minus calcelled, then you will just need to create multiple variables similar to the "finished" variable and then write the desired calculation in the return statement.
Let me know if you have any questions!
- H_KarRegular Visitor
Hi dk_dk
First of all, really appreciate you helping out.
I've new measure and inserted the code you wrote, now I have it on my data (on the far right side) as "ratio1".My objective is to visualise it now - on the value I have "count of the status". Where does "ratio 1" go. I've given it several attempts however I unfortunately failed.
here is a screenshot of the error message when i try to put it under "values"
- H_KarRegular Visitor
Yes here is a screenshot of the error message when I put ratio1 under values along count of status.