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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
AMMOORE74
Frequent Visitor

Dax Measure help - Dynamic calculation and row context?

I'm relatively new to Dax and having trouble getting my head around the row context and why my measure doesn't behave as desired.  I've tried chat GPT but didnt' really get anywhere, COPILOT was worthless.....I'm scratching my head and looking for someone that can help explain how this would work.

Below I have summarized the tables and relationships.  All are 1:many relationships

I need to dynamically assign a status/horizon value  to every row in a table visual.

I have a table of "opportunities", it links to Customer, Material and Location tables.

There are whatif parameters for the user to adjust when a record is considered frozen, slush or liquid status.

 

There are three status combinations to check, but to illustrate with just the pseudo code for FROZEN status, I'm thinking along the lines of

var category = get the category from the material table

var monthsuntilstart=get the monthsuntilstart from the summary table

var vfrozenthreshold=switch

                                            when category x return category x frozen threshold parameter value

                                            when category y return category y frozen threshold parameter value

                                            when category z return category z frozen threshold parameter value

                                            

                     

return if(monthsuntilstart<=vfrozenthreshold,"FROZEN","")

 

 

I have a table visual that when I put this in I seem to be losing all row context...that is why I was trying to do the max() iterator with the relatedtable.  I'm just grasping at straws and this feels like it shouldn't be that complicated.

 

 

 

AMMOORE74_0-1718912619639.png

DESIRED OUTPUT

AMMOORE74_1-1718913817965.png

 

1 REPLY 1
Anonymous
Not applicable

Hi @AMMOORE74 ,

 

It sounds like you're trying to dynamically assign state to each row in a table visual object based on certain conditions and parameters, and then running into issues with using DAX and row context.

 

Perhaps you could provide me with the syntax you are using?

 

This is just a thought, I can't tell if there are any syntax errors.

vhuijieymsft_0-1718934328807.png

 

Sample data and pbix files would be best if you can provide them, remember to remove sensitive information and don't log into your account when uploading pbix files in Power BI Desktop.

 

If you have any other questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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