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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Kumar_0606
Helper I
Helper I

How to create a Parameter to display data dynamically

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

 

4 REPLIES 4
bhanu_gautam
Super User
Super User

@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.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






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:

  • Create a Disconnected Parameter Table, go to Modeling --> New Table and enter this:
    ParameterDate = CALENDAR(DATE(2023, 1, 1), TODAY())

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.

  • Create the Dynamic Measure for Current Month Amount:

    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.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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