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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Variable For column

Hello good ,

I have a little doubt that it is not if it can be done in power bi, I want to create a variable for me to automatically change the column name to EJ. UC [HC+VARIABLE] DATA in order for me to change in function of the period in which this

Medida 13 0-8 = CALCULATE( SUM( 'DATOS UC'[HC202001]);' DATOS UC'[HC202001]=1;' DATOS UC'[HH202001]=1||' DATOS UC'[HH202001]=2||' DATOS UC'[HH202001]=3||' DATOS UC'[HH202001]=4||' DATOS UC'[HH202001]=5||' DATOS UC'[HH202001]=6||' DATOS UC'[HH202001]=7||' DATOS UC'[HH202001]=8)



Thank you so much!!

1 REPLY 1
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

In fact, it has not been possible so far.

DAX: Refer to column using string or similar 

 

But for your formula you can write simpler.

Medida 13 0-8 = 
CALCULATE( 
SUM( 'DATOS UC'[HC202001]),
' DATOS UC'[HH202001] >=1 && ' DATOS UC'[HH202001]<=8
)

Or like this:

Medida 13 0-8 = 
CALCULATE( 
SUM( 'DATOS UC'[HC202001]),
' DATOS UC'[HH202001] in {1, 2, 3, 4, 5, 6, 7, 8}
)

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.