Forum Discussion

hanr's avatar
hanr
Frequent Visitor
7 years ago
Solved

Counting values in query and using counted value in equation?

Hi, I'm new to PowerBI, I was wondering what the best way to count values in a group then use the count in a calculation, I have a query like this:   0 1    2    3 a  .     .     T a  .     .    ...
  • v-danhe-msft's avatar
    7 years ago

    Hi hanr ,

    Based on my test, you could refer to below formula:

    Test = SUMMARIZE('Table1','Table1'[0],"A",
            (CALCULATE(COUNT(Table1[3]),FILTER('Table1','Table1'[3]="T"))*CALCULATE(COUNT(Table1[3]),FILTER('Table1','Table1'[3]="T")))
            /(CALCULATE(COUNT(Table1[3]),FILTER('Table1','Table1'[3]="F"))*CALCULATE(COUNT(Table1[3]),FILTER('Table1','Table1'[3]="F"))))

    Result:

    You could also downlad the pbix file to have a view.

     

    Regards,

    Daniel He