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

Join 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.

Reply
DHL_FL
New Member

How to use parameter input to calculate Date

I have created a parameter and would expect that user could select the value of this parameter to calculate new date value in the dasboard. However, I couldnot make it work. The Date column (named Week_Coverage) doesnot change value with any selected value.

DHL_FL_2-1713344312458.png

 

DHL_FL_3-1713344333259.png


How could I solve this problem ?

 

1 ACCEPTED SOLUTION
samratpbi
Super User
Super User

Hi, what you need is a date dimension table with weeks in it and need to join with your fact table. then you can find the max available date in the fact table and based on that you can create an week index column in date table. Now using that index, you can filter.

Hence to start with solution, lets create Max available week column in the date dimension to see what is the max date available and its corresponding week.
 

Max week avl col =
VAR _maxDt =
CALCULATE(
    MAX(Usages[Dim Date ID]),
    ALL('Date'),
    ALL(Usages)
)
RETURN
LOOKUPVALUE('Date'[End Of Week],'Date'[Dim Date ID],_maxDt)
Once done, then create a week index column:
Week Index =
DATEDIFF('Date'[End Of Week],'Date'[Max week avl col],WEEK) + 1 (+ 1 to avoid zero for latest week)
Then I have added week index in a slicer and filter > 0 ( less than zero would be future week index)
samratpbi_0-1713348046261.png

If this resolves your problem, then please mark it as solution, Thanks!

View solution in original post

1 REPLY 1
samratpbi
Super User
Super User

Hi, what you need is a date dimension table with weeks in it and need to join with your fact table. then you can find the max available date in the fact table and based on that you can create an week index column in date table. Now using that index, you can filter.

Hence to start with solution, lets create Max available week column in the date dimension to see what is the max date available and its corresponding week.
 

Max week avl col =
VAR _maxDt =
CALCULATE(
    MAX(Usages[Dim Date ID]),
    ALL('Date'),
    ALL(Usages)
)
RETURN
LOOKUPVALUE('Date'[End Of Week],'Date'[Dim Date ID],_maxDt)
Once done, then create a week index column:
Week Index =
DATEDIFF('Date'[End Of Week],'Date'[Max week avl col],WEEK) + 1 (+ 1 to avoid zero for latest week)
Then I have added week index in a slicer and filter > 0 ( less than zero would be future week index)
samratpbi_0-1713348046261.png

If this resolves your problem, then please mark it as solution, Thanks!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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