Forum Discussion

PBE's avatar
PBE
Helper II
3 years ago

Row formulas in Table

Hi, in my previous post I found out how to allocate a row number for each row in table. There will be a maximum of 30 rows.

Is it possible to allocate a different formula to a different row?

Something like this...

Any questions let me know.

 

Thanks for help

 

3 Replies

    • PBE's avatar
      PBE
      Helper II

      Thanks again Greg_Deckler for your help. Is it possible I could calculate the answer separate from a table. I'm guessing here, perhaps allocate RN1 Work, RN1 Service and RN1 Backfill as the variables and the same for RN 2 work etc. Then use these variables to calculate the answer for each row.

       

      Such as Formula 1 = RN1 Work - RN1 Service = answer 1

      Formula 2 = RN2 Work - (RN1 Service + RN2 Service) = answer 2

       

      Then say display answer 1 in card 1 and answer 2 in card 2 etc.

       

      The part I definitely don't know is how to make RN1 Work and RN 1 Service into variables and use these in a formula.

       

      Any ideas?

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    PBE Well, more or less that is what the pattern in the article is doing. Essentially you are adding a column to the table for each recursive iteration. By doing this, you effectively avoid recursion within a single column which DAX does not like, it just makes it a complete pain to code and requires a reasonable maximum approach. Could it also be done as 30 measures instead of 30 columns in a table. Sure. But I'm not sure that is really any better and would likely be more of a pain to manage since the code would be split between 30 measures versus all in a single measure.