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
I have 2 visuals that interact with my Month-Year Filter (Format MMMM YYYY):
The 1st visual shows the selected month's data, and the 2nd visual is supposed to show the previous month's data of the selected month in filter. Each visual uses 3 measures in Y-axis.
I also have another Month-Year Filter (called Period) for the whole dashboard so I created a measure as a filter. I have included this within an IF condition in my measures so it will check if the month selected is also selected in Period filter.
As for my issue in the 2nd visual (previous month), I've tried converting my date filter back to date type then using it (tried other date columns) as a filter by setting the relative date to the last 1 calendar month, but it's being set to May 1 - May 31 statically so it always results to no data. I also tried to create a separate measure to be used as a filter but, no luck.
Any other solutions?
Solved! Go to Solution.
I was able to fix it. This worked for me:
I was able to fix it. This worked for me:
Hi @JustParagon ,
Congratulations on finding the appropriate solution through your own efforts, and I'm sure your thinking will be able to help other users on the forum.
Best Regards
Yilong Zhou
Hi @JustParagon ,
We can use a date table and create a measure to meet your requirement.
1. Create a date table based on your date, there is no relationship between two tables.
Date =
ADDCOLUMNS (
CALENDAR ( "2019/7/1", "2020/6/1" ),
"year", YEAR ( [Date] ),
"Month_name", FORMAT ( [Date], "mmm" ),
"Month_number", MONTH ( [Date] )
)
2. Create a measure like this.
Measure =
VAR selected_ =
SELECTEDVALUE ( 'Date'[Month_name] )
VAR Date_ =
CALCULATE (
MAX ( 'Date'[Date] ),
FILTER ( 'Date', 'Date'[Month_name] = selected_ )
)
RETURN
IF (
ISBLANK ( selected_ ),
CALCULATE ( SUM ( 'Table'[Values] ) ),
CALCULATE (
SUM ( 'Table'[Values] ),
FILTER ( 'Table', 'Table'[Date] <= Date_ )
)
)
3. At last we need to add a month slicer based on Date[Month_name], and the result like this.
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-yilong-msft,
The right graph for the selected month-year's data is working properly. Here's the measure used for the light blue one (and there are 2 other measures for the remaining percentages that work as expected):
As a solution, I tried this tutorial until 4:22 for the static filter: https://www.youtube.com/watch?v=CaFpeY1lPTI where DATESINPERIOD function was used. I used DimDate[Month Year] as a slicer and I modified the measure to display the previous month's data instead of the last 6 months:
LeftGraph =
VAR MaxDate = MAX('DimDate'[Date])
VAR PrevMonth = DATESINPERIOD('New Date'[Date], MaxDate, -1, MONTH)
RETURN
CALCULATE(
DIVIDE(300 - ([CountCondition1] + [CountCondition2]),
300,
0
),
REMOVEFILTERS(DimDate),
KEEPFILTERS(PrevMonth),
USERELATIONSHIP('DimDate'[Date], 'New Date'[Date]) -- Inactive
)
Unfortunately, it still did not work, because I checked which months are included in the graph by dragging the Month Year in the X-axis, and it returns ALL:
The right graph is affected, did the same thing with the X-axis, and it's still displaying correct values for a single month. So I guess the only problem here is either my filter or measure for the left graph to display previous month's data.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
User | Count |
---|---|
27 | |
17 | |
16 | |
12 | |
11 |
User | Count |
---|---|
38 | |
29 | |
22 | |
20 | |
18 |