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
harshagraj
Post Partisan
Post Partisan

To get last 6 weeks from Fiscal week

Hi all I need to get a KPI visual it should display last 6 weeks for the amount and filter to be applied is Actuals.
And also target is the Previous week. Please help me to achieve this. 

  FW        Amount       Filter

117775Actuals
115811Budget
275976Actuals
219237Budget
311759Actuals
316570Budget
444845Actuals
45427Budget
574479Actuals
518140Budget
645633Actuals
614782Budget
744307Actuals
715663Budget
883742Actuals
814049Budget
938725Actuals
915490Budget
1062828Actuals
103911Budget
1136258Actuals
1115254Budget
1298433Actuals
1216341Budget
1381397Actuals
1310890Budget
1470454Actuals
143595Budget
1570050Actuals
153920Budget
1637456Actuals
1615300Budget
1740288Actuals
1712786Budget
1850304Actuals
1819443Budget
1910167Actuals
194549Budget
2016785Actuals
2017660Budget
2186141Actuals
214632Budget
2296800Actuals
224899Budget
2310204Actuals
2318059Budget
2468222Actuals
2410216Budget
2520228Actuals
2511560Budget
2620926Actuals
2619250Budget
2782594Actuals
2711247Budget
2841238Actuals
2817816Budget
2947179Actuals
2917294Budget
1 ACCEPTED SOLUTION

I think,

 

Target Measure =
  VAR __FW = MAX([FW])
  VAR __Table = FILTER('Table',[Filter] = "Actuals" && [FW] = __FW - 1)
RETURN
  SUMX(__Table,[Amount])

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

View solution in original post

13 REPLIES 13
VijayP
Super User
Super User

In the first place , to get Time Intelligence  you need to have a Date column else your goal cannot be achieved
Once you have a DAte and Date Dim Table , this is the DAX

Calculate(Sum(Amount),
                Filter(All(DateDim),
                          DateDim[Date]>DateDim[Date]-42 && Max(DateDim[Date]))
               

42 is for 6 Weeks

Let me know if this helps

Regards

Vijay Perepa

watch my videos at www.youtube.com/perepavijay

 




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


Hi @VijayP  thanks for the help but unfortunately we dont have date column. We have only FW & FY columns.

You cna create a separate date columns based on the year and week available




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


Hi @VijayP Thankyou for the responce. Could you please help me to create that ? I have attached the Picture.

 

pbi.PNG

Greg_Deckler
Super User
Super User

Not sure I fully understand but perhaps:

 

Measure =
  VAR __FW = MAX([FW])
  VAR __MinFW = __FW - 6 + 1
  VAR __Table = FILTER('Table',[Filter] = "Actuals" && [FW] <= __FW && [FW] >= __MinFW)
RETURN
  SUMX(__Table,[Amount])

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

Hi @Greg_Deckler thanks for the quick solution. Please correct me if i am doing wrong. I have selected KPI chart and placed the Measure formula which you have helped and in Trend axis i have put FW. Still the KPI card's trend axis shows all the weeks from 1-29. I just have to show trend from week 24-29.pbi.PNG

OK, you should just be able to filter your visual. If you want to get fancy about it, create a column like:

 

Column =
  VAR __FW = MAXX('Table',[FW])
  VAR __MinFW = __FW - 6 + 1
RETURN
  IF([FW] > __MinFW,"Include","Exclude")

Then just filter your axis on that column. This way it stays up-to-date as data gets refreshed. 


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

@Greg_Deckler  It works good in Extract mode. But MAXX doesnot support in Direct mode. Any alternative for this is a biggest help!

Actually, just use MAX('Table'[Column]) instead of MAXX, that should work.

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

Wow @Greg_Deckler perfect!! thanks a lot for this. It is working just the way i wanted. One last question I have to use last week' Amount in target goal. In this case Week 29 will be current week and in the Target i want the amount of week 28. 

I think,

 

Target Measure =
  VAR __FW = MAX([FW])
  VAR __Table = FILTER('Table',[Filter] = "Actuals" && [FW] = __FW - 1)
RETURN
  SUMX(__Table,[Amount])

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

@Greg_Deckler  I dont know how to thank you but thanks a lot. It worked perfectly.

Happy to help! Glad it got you going!

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

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.