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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Selectedvalue and Date-Slicer Issue

Hello,
I have a slicer that contains a date hierarchy. Additionally, I have a table visual. 
The table visual is set to have no filter actions when the slicer is selected (using the edit interactions option).
However, in my table visual I want to show data for the previous month of the selected value in the slicer. 
The slicer date values come from a separated date table (tbl_dates).

Using the following measure I would like to get the data from the master_actuals table for the previous month of my selection.
Happy for any help. 


Measure =

Var Selected_Date = SELECTEDVALUE(tbl_dates[Date])
Var Previous_Month_Date = EOMONTH(Selected_Date,-1)
Var Prev_Month_Selected = MONTH(Previous_Month_Date)
Var Year_Selected = Year(Previous_Month_Date)

Var Result =
CALCULATE(SUM(master_actuals[Amount]),
ALL(master_actuals),
master_acutals[Month] = Prev_Month_Selected,
master_acutals[Year] = Year_Selected
)

Return Result


When I add the month and year manually it works just fine:
master_acutals[Month] = 1,
master_acutals[Year] = 2023
3 REPLIES 3
johnt75
Super User
Super User

Make sure that there is no relationship between your dates table and the master fact table, then turn interactions between the visuals. That way no filter will be applied to the fact table, but you can still use SELECTEDVALUE and your existing code should work.

Anonymous
Not applicable

Thanks for the response.
I would like to get it work even with a relationship between the two tables as it is a convenient filter for other visuals based on a date. 

You will need to enable interaction between the visuals, otherwise the selected value from the slicer will never be passed into the target visual. If the relationship needs to be present for other visuals then you will need to modify any measures used in the target visual, possibly by using a calculation group, to disable the relationship or otherwise override it.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.