Forum Discussion
Row level calculation that adds rows
Hi everyone,
I am facing a new issue on my PBI. I have a table in the following format (rand = random number) :
| month | product | value |
| dec | a | rand a |
| dec | b | rand b |
| dec | c | rand c |
| nov | a | rand a |
| nov | b | rand b |
| nov | c | rand c |
| oct | a | rand a |
| oct | b | rand b |
| oct | c | rand c |
What I want to do is create a new row for each month such as product = d, that will perform a calculation on the value when product = c (let's say 10 times the rand value when the product is c for a given month). So my outuput table should look something like that :
| month | product | value |
| dec | a | rand a |
| dec | b | rand b |
| dec | c | rand c |
| dec | d | 10 * rand c |
| nov | a | rand a |
| nov | b | rand b |
| nov | c | rand c |
| nov | d | 10 * rand c |
| oct | a | rand a |
| oct | b | rand b |
| oct | c | rand c |
| oct | d | 10 * rand c |
Would anyone know how I could perform that ? I need to keep my data in such format so that i can display it in my existing pivot table.
Thanks a lot for your help 🙂
Thomas
2 Replies
- thummaFrequent Visitor
Hi Anonymous you can use the below dax to achieve the desire result.
Column = IF('Table'[product] = "d", CALCULATE(SUM('Table'[value]), 'Table'[product] = "c") * 10, 'Table'[value])
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
Thank you- AnonymousNot applicable
Thank you. However, this is not exactly what I want. Product "d" doesn't exist at all in my first table, I want to create it