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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Meerakhanna
Helper I
Helper I

DAX formula for past 5 weeks from selected week reg,.

Hi, (Kindly let me know if the below approach is doable in PBI)

I have Dim_Week table with following columns,

Calendar YearWeekWeek dayWeek Order
20165312/26/201653
20165212/19/201652
20165112/12/201651
20165012/5/201650
20164911/28/201649
20164811/21/201648
20164711/14/201647
20164611/7/201646
20164510/31/201645
20164410/24/201644
20164310/17/201643
20164210/10/201642
20164110/3/201641
2016409/26/201640
2016399/19/201639
2016389/12/201638
2016379/5/201637

I Have a fact table but not linked with the above Dim_Week. Instead I want to create a table based on above Dim_Week which will hold only filtered values of Dim_Week. 

I have slicers created based on Dim_Week. Lets say the User selects Year = 2016 and Week as 53, then the new table should hold the values for past 5 weeks of that selected week. like the below,

Calendar YearWeekWeek dayWeek Order
20165312/26/201653
20165212/19/201652
20165112/12/201651
20165012/5/201650
20164911/28/201649

 

I will link this table with my fact to display values pertaining to the [week day] here in the new table.

I am naive in DAX. Can anyone help me with DAX for the new table? - Thank you!

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @Meerakhanna,

 

Power bi not support to create dynamic calculated column/table based on slicer.

Calculated Column/Table Change Dynamically According to Slicer Selection in the Report.


For your requirement, I'd like to suggest you use query parameter to create the dynamic filter calendar table.

 

Steps:
Duplicate the original calendar table and use the parameter as the dynamic filter.

 

Reference link:

Deep Dive into Query Parameters and Power BI Templates

Using dynamic parameter values in Power Query Queries

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @Meerakhanna,

 

Power bi not support to create dynamic calculated column/table based on slicer.

Calculated Column/Table Change Dynamically According to Slicer Selection in the Report.


For your requirement, I'd like to suggest you use query parameter to create the dynamic filter calendar table.

 

Steps:
Duplicate the original calendar table and use the parameter as the dynamic filter.

 

Reference link:

Deep Dive into Query Parameters and Power BI Templates

Using dynamic parameter values in Power Query Queries

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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