Forum Discussion

Khaoula_Farissi's avatar
Khaoula_Farissi
Frequent Visitor
5 years ago

dividing two measures

Hello

this is my data

IdBrandM1BrandM2
Wave
1ADw3
2BDw2
3CDw2
4DCw2
5AAw1
6BBw2
7CDw3
8ACw3
9BDw2
10CDw3
11DDw3
12DCw1
13DAw3
14CBw1
15ADw2
16BCw2
17DCw3
18CAw3
19ABw1

i want to calculate the percentage of column total of BrandM1 and BrandM2:

Row Labelsw1w2w3Grand Total
A50,00%14,29%25,00%26,32%
B0,00%57,14%0,00%21,05%
C25,00%14,29%37,50%26,32%
D25,00%14,29%37,50%26,32%
Grand Total100,00%100,00%100,00%100,00%

 

Row Labelsw1w2w3Grand Total
A25,00%0,00%25,00%15,79%
B50,00%14,29%0,00%15,79%
C25,00%28,57%25,00%26,32%
D0,00%57,14%50,00%42,11%
Grand Total100,00%100,00%100,00%100,00%

 

then i want to divide them (table1/table2)

Brandsw1w2w3
A2,00#DIV/0!1,00
B0,004,00#DIV/0!
C1,000,501,50
D#DIV/0!0,250,75

3 Replies

  • Khaoula_Farissi , You can have measures like

    M1 = divide(countrows(Table),calculate(countrows(Table), allexpect(Table, Table[wave])))

    M2 = divide(countrows(Table),calculate(countrows(Table), allexpect(Table, Table[BrandM1])))

    M3 = divide(countrows(Table),calculate(countrows(Table), allexpect(Table, Table[BrandM2])))

     

    last table

     

    measure 1 =
    var M1 = divide(countrows(Table),calculate(countrows(Table), allexpect(Table, Table[wave])))
    var M2 = divide(countrows(Table),calculate(countrows(Table), allexpect(Table, Table[BrandM1])))
    return
    divide(M1,M2)

  • Khaoula_Farissi , You want to use M1 and M2 in same row, that is bit different. I create a file, Check that. You need check you second martix is grouping M2 or Using M2 in formula but grouping M1, based on that you have to change formula.

     

    Please find the file attached after signature.