Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello,
I managed to calculate a cumulative rolling day in a column of my table.
I use the function "DATESINPERIOD"
I would like to replace the "static" number parameter by a dynamic parameter
I know that datatable are kind of "static" and can’t be updated with a "what-if" paramater.
By the past I managed to generate a dynamic datable thanks to "SWITCH" function, but it was totally different needs and I can’t apply this "trick" to my actual need.
Any help would be appreciated !
Thanks
Solved! Go to Solution.
Hi @Atiroocky
Calculated columns cannot be dynamic as they do not interact with the fiter conext of the report. This has to be a measure
Count =
CALCULATE (
SUM ( 'Table_DHU'[CityLocation] ),
ALL ( 'Table_DHU' ),
DATESINPERIOD (
'Table_DHU'[Date],
MAX ( 'Table_DHU'[Date] ),
- [Parameter],
DAY
)
)
Hi @Atiroocky
Calculated columns cannot be dynamic as they do not interact with the fiter conext of the report. This has to be a measure
Count =
CALCULATE (
SUM ( 'Table_DHU'[CityLocation] ),
ALL ( 'Table_DHU' ),
DATESINPERIOD (
'Table_DHU'[Date],
MAX ( 'Table_DHU'[Date] ),
- [Parameter],
DAY
)
)
Thanks, that works perfectly !
As a "beginner" I’m not very comfortable playing with "Measures". A bit earlier before posting in this forum, I tried to put the column code in a measure, but I used Table_DHU[Date] as start date instead of "MAX(Table_DHU[Date])". I was returning me an error.
For me "MAX" was the last entry of all table data. But I was thinking as "table" data and no "measure" data. It is still a bit confused in my mind but time will help.
Thanks again !
@Atiroocky
MAX ( 'Table'[Column] ) when used in a calculated column returns the max value in this column becuase there is no filter context. However when used in a measure it will return the max value avialable in the current filter context. In other words, the value is different from one row to another.
Thanks for your explanation. That helps me better understanding.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
9 | |
7 | |
7 | |
6 |
User | Count |
---|---|
21 | |
11 | |
10 | |
9 | |
8 |