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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Mithilesh1
New Member

Making a dax function for showing last week data and last to last week data from selected date from

Hello everyone,

I have a question to ask. I have been assigned to make a table at my intern company to make a Dax function to show data from last week and last to last week's data from the start date in the slicer.

This is my current dashboard and I want to show last week's data table and a last to last week's data table from the selected start date by the client which allows them to compare the data of the selected date, then last week's data from the start date and last to last week data from the start date. Can anyone please help me out? This is not an actual set since I am not allowed to share data outside the company.

PBIX File:- https://drive.google.com/file/d/1aLwov5HVdrLKI5hhenxbNcfVEjDVkY-x/view?usp=sharing
Dashboard:- https://drive.google.com/file/d/1PkBg9Oq4YogSw0Qq77ZUJ4vkA2ZpKE_0/view?usp=sharing

 

1 ACCEPTED SOLUTION

Things you missed in my pbix:

  • Date slicer is using the column from the disconnected table. Regardless of whether you use between or a dropdown, current week and previous week measures will be calculated with reference to the max visible date. 
  • Use either a date column from a related or from the fact table in your visual. You used the one from disconnected table in the pbix you attached. Your fact table have missing dates so you can't use logged date if you want to show 0 for days without a ticket.

danextian_0-1750673543674.png

Please see the attached pbix.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

7 REPLIES 7
v-ssriganesh
Community Support
Community Support

Hello @Mithilesh1,
I hope the information provided has been useful. Please let me know if you need further clarification or would like to continue the discussion.
If your question has been answered, please “Accept as Solution” and Give “Kudos” so others with similar issues can easily find the resolution.
Thank you.

v-ssriganesh
Community Support
Community Support

Hello @Mithilesh1,

Just checking in have you been able to resolve this issue? If so, it would be greatly appreciated if you could mark the most helpful reply accordingly. This helps other community members quickly find relevant solutions.
Please don’t forget to “Accept as Solution” and Give “Kudos” if the response was helpful.
Thank you.

v-ssriganesh
Community Support
Community Support

Hi @Mithilesh1,

Thank you for posting your query in the Microsoft Fabric Community Forum, and thanks to @danextian for sharing valuable insights.

 

Could you please confirm if your query has been resolved by the provided solution? If so, please mark it as the solution. This will help other community members solve similar problems faster.

Thank you.

danextian
Super User
Super User

Hi @Mithilesh1 

I answered just a while ago a very similar question in this post https://community.fabric.microsoft.com/t5/Desktop/Current-vs-Previous-Period-based-on-date-selection... 

danextian_0-1750590038239.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hello @danextian , thanks for the solution, I tried it but I had something else desired. So, basically what I wanted is to make two tables with each one showing a week earlier and other one week-to-week earlier. Like only 7 days behind in one table and 8 to 14 days behind in other table. Not to go beyond that.

Currently, it is showing me a week forward data from selected date for some reason. 

Mithilesh1_1-1750611489084.pngMithilesh1_2-1750611503169.pngMithilesh1_3-1750611515969.png

 

I have attached the formulas for the reference as well. I changed the Sum to count since it wasn't working out the way I intended it to.



PBIX File:- https://drive.google.com/drive/folders/1tdiiWuCGhsyJ7VgHkBweqxX7twbd3Okx?usp=sharing

Things you missed in my pbix:

  • Date slicer is using the column from the disconnected table. Regardless of whether you use between or a dropdown, current week and previous week measures will be calculated with reference to the max visible date. 
  • Use either a date column from a related or from the fact table in your visual. You used the one from disconnected table in the pbix you attached. Your fact table have missing dates so you can't use logged date if you want to show 0 for days without a ticket.

danextian_0-1750673543674.png

Please see the attached pbix.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Will the same work for the in between slicer as well? Like i need to show the same but rather showing it in one table, it will be separate table?

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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