March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello,
I have an if statement, where I want to show Sales Value when the weekyearnr is less than the current week. Otherwise, use the Forecast Value.
In my QlikView past I'd do:
IF('Calendar'[YearWeekNr]) < [Today (Week)], [Sales Value], [Forecast Value])
In PowerBI, this seems to work when looking at all values:
Solved! Go to Solution.
Try this ...yes you aggregate function..TRY THIS
IF(max('Calendar'[YearWeekNr]) < [Today (Week)], [Sales Value], [Forecast Value]) + 0
Try this ...yes you aggregate function..TRY THIS
IF(max('Calendar'[YearWeekNr]) < [Today (Week)], [Sales Value], [Forecast Value]) + 0
Hi @ribisht17
I assumed that too originally, but unless my syntax is wrong, it says it cannot find the field 'Calendar'[YearWeekNr]
It is written the same way as what you've listed on your message. Using something like SELECTEDVALUE then renders it fine.
I do get a little lost with syntax when referencing a measure compared to that of a field in a table, so it may be something obvious I've not done!
Looking at this thread, I need an aggregation function to use column fields?
https://community.powerbi.com/t5/Desktop/New-Measure-Cannot-find-name-from-table-column/m-p/2296157
Regards,
Ritesh
Hello @ribisht17
Thank you for your response, I've tried but I don't think I fully understand how to use RELATED in this example. You're quite rght that I'm not looking to read the current filter context, but rather the row values.
How would RELATED work in my example where I'm evaluating the value of each column to a measure?
Many thanks,
Dayna
In your case, you don't need RELATED, remove SELECTEDVALUE
IF(('Calendar'[YearWeekNr]) < [Today (Week)], [Sales Value], [Forecast Value]) + 0
Regards,
Ritesh
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |