Forum Discussion

BenFransen's avatar
BenFransen
Advocate II
9 years ago
Solved

Dynamic property access?

I have created a measure like _thisDateCode = if(month(today())=1; "Jan"; if(.. up to dec   In my data I have columns from Jan, Feb, .. Dec.   I tried to make a calculation for the current month ...
  • v-yulgu-msft's avatar
    9 years ago

    Hi BenFransen,

     

    Based on my understanding, you want to make a calculation for current month, right? 

     

    In your scenario, rather than using a measure to convert today's month number to month name, like Jan, Feb, Mar, etc, why don't you convert the text value in month column to numeric month number, like 1,2,3, etc.

     

    You can create a calculated column called [MonthNo] in 'my_table' using below formula:

    MonthNo=IF('my_table'[Month]="Jan",1,IF('my_table'[Month]="Feb",2,IF(...up to 12))

     

    Then, the calculattion measure could be:
    This Months Total = sumx(filter('my_table', 'my_table'[year]=year(today()), 'my_table'[MonthNo]=Month(Today())),'my_table'[ColumnName])

     

    If I have something misunderstood, please elaborate your requirement with some sample data, and it would be better you can post an image to describe your expect output.

     

    Best regards,
    Yuliana Gu