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
Hi,
I want to get the week number of next week based on filter context. Below is the measure I have written, for some reason, the var next_week always generates 1. However, var week seems to work correctly. Why add 1 to var week causes a problem?
Solved! Go to Solution.
My guess is that your year and week variables are returning blank, and blank + 1 = 1. Try returning those instead of next_week to see if they are working correctly. Why not just use MAX(Dim_Calendar[WeekNumber])? Why do you need the CALCULATE with KEEPFILTERS?
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
My guess is that your year and week variables are returning blank, and blank + 1 = 1. Try returning those instead of next_week to see if they are working correctly. Why not just use MAX(Dim_Calendar[WeekNumber])? Why do you need the CALCULATE with KEEPFILTERS?
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
I would like to correct myself, actually the problem is not due to data refreshment, but because I have a country filter in the selection pane, because there is no data between week 1-23, the var week measure only generates result from week 23, while var next_week will generate 1 since var week=0. I should have paid attention to the filtering context.
There seems to be some data refreshment issue. Now var next_week generates correct results.
Here is the result of var week. As you can see, it works properly. By the way, you are right that I don't need keepfilters() in this measure.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
112 | |
75 | |
57 | |
52 | |
44 |
User | Count |
---|---|
157 | |
113 | |
63 | |
60 | |
50 |