cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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.

How could I solve this problem ?

1 ACCEPTED SOLUTION
Solution Supplier

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)

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

Solution Supplier

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)

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

Announcements

#### Fabric certifications survey

Certification feedback opportunity for the community.

#### Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors