Forum Discussion

FZOU's avatar
FZOU
Helper IV
6 years ago
Solved

DAX CALCULATION

Hello,

i'm working on a calculated column but i can't get the right result, i have this table and percentYear as a filtre :

My new column named NewPercent should calculate the percent based on product and PercentYear :

If the product is empty like the table above and we don't have a selected PercentYear so 1/12 else if we select a percentyear it should display the Percent equal to the percent column

 

this is my column formula

 

NewPercent = IF(RELATED(Products[Product])="" && ISFILTERED(App[PercentYear])=FALSE();1/12;App[Percent])
 
until now it works the formula return the 1/12 but when i select a value from PercentYear it should display the percent not 1/12
and i can't achieve it.
  • Hi FZOU ,

     

    Is your "NewPercent" a calculated column? If you want a dynamic value, you could create a measure to replace this column.

     

3 Replies

  • FZOU 

    I did not get it completely. But you can use earlier to work on the same table

    sumx(filter(Table,Table[Year] = earlier(Table[Year]) && Table[Product] = earlier(Table[Product])),Table[Percent])

     

    Sumx can be maxx, averagex or minx

  • v-eachen-msft's avatar
    v-eachen-msft
    Community Support

    Hi FZOU ,

     

    Is your "NewPercent" a calculated column? If you want a dynamic value, you could create a measure to replace this column.

     

    • FZOU's avatar
      FZOU
      Helper IV

      v-eachen-msft  Exactly it was that my problem i transform it to a mesure and it works thank you