Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Measure for Line diagramm

Hi!

 

I am kind of new to PowerBI and I wanted to do a ratio. So I figured I can divide somehow like this:

 

Test = 1 - DIVIDE(CALCULATE(COUNT('Table1'[A]), FILTER('Table1','Table1'[A] = "Closed")),COUNT('Table1'[B]))
 
This works perfectly fine with cards, because PowerBI calculates ALL "Closed" Cases by the number of all cases,
but I want to show it in a line diagramm and the calculation does something i did not expect:
 
It calculates:
All closed cases on a date / All cases on a date
 
But what I wanted to do is the following:
All closed cases UNTIL a date / All cases UNTIL a date
 
All help is very appreciated!
 
Best regards
MSOMME
  • Hi Anonymous ,

    You can create a Running Total measures for them: For ex:

    Test=
    Var A= CALCULATE(CALCULATE(COUNT('Table1'[A]), FILTER('Table1','Table1'[A] = "Closed")), FILTER(ALLSELECTED(Table1[Date]), Date <= MAX( Table[Date])))

    Var B= CALCULATE(COUNT('Table1'[B]), FILTER(ALLSELECTED(Table1[Date]), Date <= MAX( Table[Date])))

    Return (1- DIVIDE(A,B))

     

    I hope this helps!

2 Replies

  • Tanushree_Kapse's avatar
    Tanushree_Kapse
    Icon for Impactful Individual rankImpactful Individual

    Hi Anonymous ,

    You can create a Running Total measures for them: For ex:

    Test=
    Var A= CALCULATE(CALCULATE(COUNT('Table1'[A]), FILTER('Table1','Table1'[A] = "Closed")), FILTER(ALLSELECTED(Table1[Date]), Date <= MAX( Table[Date])))

    Var B= CALCULATE(COUNT('Table1'[B]), FILTER(ALLSELECTED(Table1[Date]), Date <= MAX( Table[Date])))

    Return (1- DIVIDE(A,B))

     

    I hope this helps!

  • Anonymous's avatar
    Anonymous
    Not applicable

    That worked as solution. Thank you! 🙂