March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello to the forum,
I have a question.
I have the Orders and Calendar tables in Power BI Desktop. Both are linked by a 1-n relationship:
My data model
In the Orders table I have the following data:
Table "Orders"
I want to generate the following report:
In a slicer, the user selects a specific date. In a further slicer, he can then set how many days he would like to look into the past, starting from the selected date. (Here I use a numeric parameter.)
Here is an example:
If the user selects 04/10/2023 and wants to look 7 days into the past, then the line chart should show:
An example report
In the line chart, the days 03.04. – 04/10/2023 are displayed.
(In the example, I filtered the diagram by hand.)
Does anyone have an idea how I can implement this?
Greetings
Solved! Go to Solution.
@Jan_Trummel Try something below. Note, assumes disconnected tables for slicers. PBIX is attached below signature.
Measure =
VAR __Date = MAX('Dates'[Date])
VAR __DaysBack = [Parameter Value]
VAR __OrderDate = MAX('Orders'[Order date])
VAR __Result = IF(__OrderDate <= __Date && __OrderDate >= __Date - __DaysBack, SUM('Orders'[Sales]), BLANK())
RETURN
__Result
@Jan_Trummel Try something below. Note, assumes disconnected tables for slicers. PBIX is attached below signature.
Measure =
VAR __Date = MAX('Dates'[Date])
VAR __DaysBack = [Parameter Value]
VAR __OrderDate = MAX('Orders'[Order date])
VAR __Result = IF(__OrderDate <= __Date && __OrderDate >= __Date - __DaysBack, SUM('Orders'[Sales]), BLANK())
RETURN
__Result
Hi, @Greg_Deckler do you think there is a solution where the Calendar table can stay connected to the Orders table?
This would be exactley what I need.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
134 | |
91 | |
89 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
72 | |
68 |