Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hello Experts,
I have a date field. I want to display data dynamically so that whenever User selects particular date, data should be filtered accordingly.
I created a Date parameter (transform data-> New Parameter) with some Values and joined (Many to One) with the actual table.
Now I am trying to create a calculation
Flag Current Month=YEAR(Table[Date]) = YEAR(Paramter table[Date])
Here I'm unable to select the Parmater Date as they are not populating.
Am i missing something or is there any other way to create the flags CM, PM, CY, PY etc.
Thanks in advance
Solved! Go to Solution.
Hi @Kumar_0606,
Based on your requirement, the only reliable and supported approach for dynamic filtering like this is by using a Disconnected Date Parameter Table with Dynamic Measures.
Here the SELECTEDVALUE(ParameterDate[Date]) returns blank because the slicer uses a formatted MonthYear column that maps to multiple dates. This leads to multiple values being selected behind the scenes and SELECTEDVALUE does not return a value in such cases.
This will make sure accurate dynamic filtering using disconnected tables and give full flexibility to create CM, PM, PY flags in measures.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thanks and regards,
Anjan Kumar Chippa
@Kumar_0606 You need to create calculated fields to flag the current month, previous month, current year, and previous year based on the selected date parameter.
FlagCurrentMonth =
IF(
YEAR(Table[Date]) = YEAR(SELECTEDVALUE(ParameterTable[Date])) &&
MONTH(Table[Date]) = MONTH(SELECTEDVALUE(ParameterTable[Date])),
1,
0
)
FlagPreviousMonth =
IF(
YEAR(Table[Date]) = YEAR(SELECTEDVALUE(ParameterTable[Date])) &&
MONTH(Table[Date]) = MONTH(SELECTEDVALUE(ParameterTable[Date])) - 1,
1,
0
)
FlagCurrentYear =
IF(
YEAR(Table[Date]) = YEAR(SELECTEDVALUE(ParameterTable[Date])),
1,
0
)
FlagPreviousYear =
IF(
YEAR(Table[Date]) = YEAR(SELECTEDVALUE(ParameterTable[Date])) - 1,
1,
0
)
Make sure that your parameter table is properly linked to your main table. The SELECTEDVALUE function is used to get the value of the parameter selected by the user.
Proud to be a Super User! |
|
Hello Gautam,
Thanks for the reply.
I created Current Month flag as you suggested and created a column like
Amount CM= IF ([Flag Current Month]=1 && Table[Version]="New", [Amount]))
When i pulled this to the table, getting Blank value.
Hi @Kumar_0606,
Thank you for reaching out to Microsoft Fabric Community.
Thank you @bhanu_gautam for the prompt response.
To filter data dynamically based on a selected date, please follow these steps:
This creates a date table that is not joined to your main data table. Do not create any relationships. Now add this ParameterDate[Date] column to a slicer on the report, so that to select a date.
Amount CM = VAR SelectedDate = SELECTEDVALUE(ParameterDate[Date])
RETURN
CALCULATE(
SUM('Table'[Amount]),
'Table'[Version] = "New",
YEAR('Table'[Date]) = YEAR(SelectedDate),
MONTH('Table'[Date]) = MONTH(SelectedDate)
)
This measure will return the total amount for the current month based on the selected date in the slicer.
Do not use calculated columns or Power Query parameters directly in DAX, because they are static and will not respond to slicer selections, so dynamic filtering will not work.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thanks and regards,
Anjan Kumar Chippa
Hello Anjan Kumar,
Thanks for the reply.
I created the ParameterDate table and the Measure Amount CM as you suggested.
When I change the ParamterDate in the slicer the table values are not changing accordingly.
Secondly how can i display ParamterDate like Jan 2025, Feb 2025. Mar 2025 etc in the slicer.
Hi @Kumar_0606,
Check if the visual is using the Amount CM measure, only the visuals that use this measure will respond to the slicer. And also check if the slicer is using multiple selections and change it to select single mode.
To display the ParameterDate, add a new column to the ParameterDate table for example like below
MonthYear = FORMAT(ParameterDate[Date], "MMM YYYY")
And use this MonthYear column in the slicer instead of the raw date.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thanks and regards,
Anjan Kumar Chippa
Hello Anjan,
I am using only one visual here with Amount CM.
Also checked the slicer is Single select, not sure why the visual is not responding to the slicer.
Hi @Kumar_0606
If the parameter isn't working as expected, you can definitely try using a normal slicer directly on the date field. With a regular slicer, you can select the date or time period you want to filter by, and the visual will respond accordingly.
However, using a disconnected parameter is still the preferred method for more advanced dynamic filtering and comparisons (like comparing current and previous periods) without restricting the data.
Hi @Kumar_0606,
As we haven’t heard back from you, we wanted to kindly follow up to check if this solution resolved your issue?
Thanks,
Anjan Kumar Chippa
I tried the solutions mentioned here however didn't work.
I can't create a simple slicer because I don't have a direct field in the table
Hi @Kumar_0606,
Based on your requirement, the only reliable and supported approach for dynamic filtering like this is by using a Disconnected Date Parameter Table with Dynamic Measures.
Here the SELECTEDVALUE(ParameterDate[Date]) returns blank because the slicer uses a formatted MonthYear column that maps to multiple dates. This leads to multiple values being selected behind the scenes and SELECTEDVALUE does not return a value in such cases.
This will make sure accurate dynamic filtering using disconnected tables and give full flexibility to create CM, PM, PY flags in measures.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thanks and regards,
Anjan Kumar Chippa
Hi @Kumar_0606,
As we haven’t heard back from you, we wanted to kindly follow up to check if this solution resolved your issue? or let us know if you need any further assistance.
Thanks,
Anjan Kumar Chippa
Hi @Kumar_0606,
We wanted to kindly follow up to check if the solution resolved your issue? or let us know if you need any further assistance.
Thanks,
Anjan Kumar Chippa