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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Atiroocky
Frequent Visitor

Column in datatable with dynamic function paramater

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

 

PowerBI - Table dynamic 2023-08-22 09.04.32.excalidraw.png

 

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

1 ACCEPTED SOLUTION
tamerj1
Community Champion
Community Champion

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
    )
)

View solution in original post

4 REPLIES 4
tamerj1
Community Champion
Community Champion

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.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.