Forum Discussion

TT1's avatar
TT1
Icon for Helper I rankHelper I
6 years ago
Solved

How to countif per columns to 1 unique Data

How do i summarize the title and result in a matrix and count it, in excel, it would be a simple countif.   Example, talbe below:   Week1 Week2 Week3 A A A A A A A A A A A...
  • tex628's avatar
    tex628
    6 years ago

    You can just do a reference to the table and create a copy in power query. Then you can do all kinds of pivots without ruining your original table. 

    The other solution i had in mind is creating a small table:

    A

    B
    C

    Then create a relationship between this column and each of your week columns. The relationships should not be active. 

    Finally create measures, along this lines of this:

    Week1 = Calculate(countrows([Week1]) ; USERELATIONSHIP( [NewColumn] ; Week1))
    Week2 = Calculate(countrows([Week2]) ; USERELATIONSHIP( [NewColumn] ; Week2))

    etc...

    Finally use the A/B/C column in the new table as a legend or row dimension with the new measures and you should be all set. 


    I'm going on lunch but let me know if you need any help!

    / J

     

  • tex628's avatar
    tex628
    6 years ago

    Alright, never mind my previous message. Heres the columns:

    week1 times = 
    VAR cat = Table2[Result]
    VAR UT = Table2[Unit Time]
    return
    CALCULATE(COUNTROWS(Table1) * UT;Table1[Week1] = cat )
    week2 times = 
    VAR cat = Table2[Result]
    VAR UT = Table2[Unit Time]
    return
    CALCULATE(COUNTROWS(Table1) * UT;Table1[Week2] = cat )
    week3 times = 
    VAR cat = Table2[Result]
    VAR UT = Table2[Unit Time]
    return
    CALCULATE(COUNTROWS(Table1) * UT;Table1[Week3] = cat )


    / J