Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

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) :

 

monthproductvalue
decarand a
decbrand b
deccrand c
novarand a
novbrand b
novcrand c
octarand a
octbrand b
octc

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 :

 

monthproductvalue
decarand a
decbrand b
deccrand c
decd10 * rand c
novarand a
novbrand b
novcrand c
novd10 * rand c
octarand a
octbrand b
octc

rand c

octd

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

  • thumma's avatar
    thumma
    Frequent 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
    • Anonymous's avatar
      Anonymous
      Not 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