Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
BenFransen
Advocate II
Advocate II

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 column like: This Months Total = sumx(filter('my_table'; 'my_table'[year]=year(today()); 'my_table'[_thisDateCode])

 

But that doesn't seem to work, I get an error:

 

Can I access a column dynamically using a measure? I got it working creating 11 if statements in the sumx' expression, but that feels clumsy. Besides I also need to make more measures with multiple criteria in the filter expression and would like to isolate repeating DAX parts to measures/variables.

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

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

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yulgu-msft
Microsoft Employee
Microsoft Employee

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

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

That's a possiblity as well, but it would be neater if it is/was possible to reference a column name dynamically. For now I'll stick with the current approach.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors