cancel
Showing results for
Did you mean:
Frequent Visitor

## Dividing rows

Hi All,

Table is set up like this.

measure 1      measure 2     year 1    year 2    year 3

Flower            rose               5            3           1

Flower            lily                 0             1          6

Flower            aster              2            5           4

Trees              pine               3            5           8

Flower            coconut         2            6           0

Flower            mango          9             7          3

Now I want to divide the total sum of Flower with regards to trees sum(flower)/sum(trees) such that the table will show

measure 1       year 1    year 2    year 3

Flower/trees      2            2           1

how do I create a dax measure to divide rows?

Thank you!

Kind Regards,

1 ACCEPTED SOLUTION
Super User IV

You should unpivot your year columns.

Then you can do something like this:

`Flowers/trees = CALCULATE(SUM('FlowersTrees'[Value]),'FlowersTrees'[Measure1]="Flower")/ CALCULATE(SUM('FlowersTrees'[Value]),'FlowersTrees'[Measure1]="Trees")`

I do not get the numbers that you presented in your solution though from the data you provided.

---------------------------------------

##### I have a NEW book! DAX Cookbook from Packt
Over 120 DAX Recipes!

Proud to be a Super User!

Super User IV

You should unpivot your year columns.

Then you can do something like this:

`Flowers/trees = CALCULATE(SUM('FlowersTrees'[Value]),'FlowersTrees'[Measure1]="Flower")/ CALCULATE(SUM('FlowersTrees'[Value]),'FlowersTrees'[Measure1]="Trees")`

I do not get the numbers that you presented in your solution though from the data you provided.

---------------------------------------

##### I have a NEW book! DAX Cookbook from Packt
Over 120 DAX Recipes!

Proud to be a Super User!

Announcements

#### Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.