Forum Discussion
huva
7 years agoFrequent Visitor
how to divide cells not column
Hi There,
I need to calculate education transition rate and I have to divide students enrolled in 2014 by students enrolled in 2014. I cannot divide one ColumnC by ColumnB I need to divide cells. Below is an excel snapshot of what I want. I hope it makes is clear.
Thank you,
Hi huva
Please see the below, this should work.
Column = VAR _prevYear = 'transition'[Year] - 1 VAR _prevG1 = CALCULATE( SELECTEDVALUE( 'transition'[9_students] ), ALLEXCEPT( 'transition', transition[Region] ), 'transition'[Year] = _prevYear ) RETURN DIVIDE( 'transition'[10_students], _prevG1 )The problem was that the formula was expecting one value in "SELECTEDVALUE" but was receiving multiple for each region in a year, now I've reintroduced a filter on the Region wit ALLEXCEPT, so we are returning a single value for previous year within each region.
Hope this make sense.Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
10 Replies
- Mariusz
Community Champion
Hi huva
You can add a column to your table with the below DAX expression.Column = VAR _prevYear = 'Table'[Year] - 1 VAR _prevG1 = CALCULATE( SELECTEDVALUE( 'Table'[grade 1] ), ALL( 'Table' ), 'Table'[Year] = _prevYear ) RETURN DIVIDE( 'Table'[grade 2], _prevG1 )Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.