Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

count value from multiple columns and multiple rows

Hi all,   I have a list of bids against competitor informaiton, in each row, there's 3 columns to capture total 3 competitors. I need to calculate the total number of appearance accorss all 3 compe...
  • az38's avatar
    6 years ago

    Hi Anonymous 

    the best way is to use Power Query Mode:

    Select by left click + ctrl your columns Competitor1, Competitor2, Competitor2 then right click and Unpivot Only Selected columns.

     

    After, you will have 2 options:

    1. Apply data and simply aggregate in visual: Value (new field from previous step) and its count

    2. In power query mode right click on Value (new field from previous step)  -> Group By then

     

    do not hesitate to give a kudo to useful posts and mark solutions as solution

  • az38's avatar
    az38
    6 years ago

    Anonymous 

    you could create a calculated table

    Table = CROSSJOIN(DISTINCT('BIDS Table'[Product]);
    UNION(
        SELECTCOLUMNS('BIDS Table';"Competitor";[Competitor1]);
        SELECTCOLUMNS('BIDS Table';"Competitor";[Competitor2]);
        SELECTCOLUMNS('BIDS Table';"Competitor";[Competitor3])
    )
    )

    then summarize in visual or create a new table

    Table Summ = SUMMARIZE('Table';'Table'[Product];'Table'[Competitor];"Number";countrows('Table'))

    do not hesitate to give a kudo to useful posts and mark solutions as solution