Forum Discussion

SebaSpotti's avatar
SebaSpotti
Icon for Advocate II rankAdvocate II
2 years ago
Solved

Using a measure to define a CALCULATETABLE

Hi, I'm creating a CALCULATETABLE  in this way:

 

CalcTable= CALCULATETABLE(Table,
Table[Name] in {"A","C","F},
Month(Table[Date])=Table[ExamMonth]))
 
But i get an error. Note that 'Table'[ExamMonth] is a measure, if I insert directly a number, such as 4, the CalcTable get generated.
 
Any suggestions?
Thanks!
  • Hey SebaSpotti ,

     

    you can try the following:

    CalcTable =
    VAR _ExamMonth = [ExamMonth]
    RETURN
        CALCULATETABLE (
            Table,
            Table[Name] IN { "A", "C", "F" },
            MONTH ( Table[Date] ) = _ExamMonth
        )
    

     

    I'm wondering, what exactly do you plan to do?
    Do you want to use that in a measure or do you want to use that as a calculated table? Be aware if you are using a calculated table, that table is not dynamic. So after loading the file, the table won't change anymore.

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution โœ”๏ธ and give it a thumbs up ๐Ÿ‘

    Best regards
    Denis

    Blog: WhatTheFact.bi
    Follow me: twitter.com/DenSelimovic

2 Replies

  • selimovd's avatar
    selimovd
    Icon for Most Valuable Professional rankMost Valuable Professional

    Hey SebaSpotti ,

     

    you can try the following:

    CalcTable =
    VAR _ExamMonth = [ExamMonth]
    RETURN
        CALCULATETABLE (
            Table,
            Table[Name] IN { "A", "C", "F" },
            MONTH ( Table[Date] ) = _ExamMonth
        )
    

     

    I'm wondering, what exactly do you plan to do?
    Do you want to use that in a measure or do you want to use that as a calculated table? Be aware if you are using a calculated table, that table is not dynamic. So after loading the file, the table won't change anymore.

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution โœ”๏ธ and give it a thumbs up ๐Ÿ‘

    Best regards
    Denis

    Blog: WhatTheFact.bi
    Follow me: twitter.com/DenSelimovic

    • SebaSpotti's avatar
      SebaSpotti
      Icon for Advocate II rankAdvocate II

      selimovd thank you!

       

      I was simply trying to calculate some measure, but probably i need them to be update so i'm changing the calculations.