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
Anonymous
Not applicable

Dynamic Last 4 Weeks when selected fiscal week in Slicer(i.e-selected value + Last 3 Weeks)

Dear All,

 

How to create Dynamic Last N Weeks based on Fiscal_Week number, when Fiscal Week value in slicer is selected, in matrix visual or any pivot visual, Selected week + last 3 weeks should appear  

 

Below 

I have created Matrix Visual which contains details below -

 

On Rows - Product-L1

On Colums - Fiscal Week

Values  - Efficiency

 

Below Screenshot

 

Vis_Pane.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Then i created Matrix Visual using these colums, screensot below -

 

Matrix Visual (Fiscal Weeks @ Column Level)Matrix Visual (Fiscal Weeks @ Column Level)

 

 

 

 

 

 

 

 

 

Above image i have selected 202033, 32, 31, 30 manually

 

Outcome - Now if i select 202033 automatically visual should show 202033, 20232, 202031, 202030

 

DataSet

7 REPLIES 7
Greg_Deckler
Super User
Super User

@Anonymous - Replying from your PM. First, some sample data in a format that can be copied would be very helpful. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490.

 

That being said, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/m-p/434008

 

You should be able to figure out the last 4 weeks and only return values for those weeks, which should automatically exclude all of the other weeks in your matrix visual.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler  - as you said i want in this way

 

"You should be able to figure out the last 4 weeks and only return values for those weeks, which should automatically exclude all of the other weeks in your matrix visual."

 

Files below- 

Sample Data and pbxi file

amitchandak
Super User
Super User

Try something like this

Last 4 WEEK
var _max_week = max(Fiscal Week)
var _date = calculate(max(date),all([Fiscal Week]),[Fiscal Week]=_max_week)
var _min_week = calculate(min(Fiscal Week),[date]= datediff(date,-28,day)

return
calculate(sum(x),all([Fiscal Week]), [Fiscal Week] >=_min_week and [Fiscal Week] <=_max_week)
Anonymous
Not applicable

Getting error amit - screenshot below

Max error.PNG

in third one in place of _date_ use vwReportinData[created_on]

Anonymous
Not applicable

i have only createddate column as below snap,

6C758857.PNG

 

 

 

 

 

 

 

 

 

 

 

 

As i dont have created_one column, can you help me understand about this line  "in third one in place of _date_ use vwReportinData[created_on]"

also can you please re-frame query and send it

Oh, you have created_date, copy from image in

third one in place of _date_ use vwReportinData[created_date].(Third in the sequence)

 

In case it does not work, paste formula, not image.

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.