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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
manoj_0911
Post Patron
Post Patron

Assistance Needed: Implementing Date Period Parameter in Power BI

Hello Power BI Community,

 

I'm currently working on transitioning my reports from Tableau to Power BI, and I'm facing a challenge regarding the implementation of a dynamic date period parameter.

In Tableau, I had successfully created a table visual with a date period parameter that allowed users to select different time intervals such as month, day, hour, or sub-hour. Depending on the selected interval, the table displayed data at the corresponding level of granularity.

Here's how I implemented it in Tableau:

Date Period Parameter Calculation:
```
DATE PERIOD = CASE [PERIOD]
WHEN 'MONTH' THEN [MONTH]
WHEN 'DAY' THEN [DAY]
WHEN 'HOUR' THEN [HOUR]
WHEN 'SUB-HOUR' THEN [SUB-HOUR]
END
```

**Granularity Calculations:**
```
MONTH = LEFT(STR(DATENAME('month',[Ixn Subhour Date])),3)+"-"+RIGHT(DATENAME('year',[Ixn Subhour Date]),2)

DAY = STR(DATEPART('month',[Ixn Subhour Date]))+"/"+STR(DATEPART('day',[Ixn Subhour Date]))+"/"+STR(DATEPART('year',[Ixn Subhour Date]))

HOUR = STR(datetime( str(date([Ixn Subhour Date]))+" "+str(datepart('hour',[Ixn Subhour Date]))+":"+ '00' ))

SUB-HOUR = STR(datetime( str(date([Ixn Subhour Date]))+" "+str(datepart('hour',[Ixn Subhour Date]))+":"+ right("0"+str(int(datepart('minute',[Ixn Subhour Date])/30)*30),2) ))
```

I'm now looking to replicate this functionality in Power BI. Essentially, I need to create a parameter that allows users to select the granularity of the date period (month, day, hour, or sub-hour) and dynamically adjust the table visual accordingly.

Could you please provide guidance or step-by-step instructions on how to achieve this in Power BI? Any assistance or insights would be greatly appreciated.

Thank you in advance for your help!

Screenshot PERIOD PARAMETER.pngScreenshot MONTH.pngScreenshot DAY.pngScreenshot HOUR.pngScreenshot SUBHOUR.png

Best regards,
Manoj Prabhakar

1 REPLY 1
Jonvoge
Super User
Super User

Hi Manoj.

 

You may leverage the feature called 'Field Parameters' for this in Power BI. It works for both Dimensions and Values, including Date Columns, but do note that the feature is still in preview: Let report readers use field parameters to change visuals (preview) - Power BI | Microsoft Learn

 

Field Parameters allow you to create a dynamic fields, which depending on selection in a filter, will display the selected dimensions/values. 

 

You begin by going to the Modeling Tab in Power BI Desktop, and select New Parameter -> Fields:

Jonvoge_0-1708433471647.png

 

Next, choose any number of Columns of any format you wish to add to the parameter:

Jonvoge_1-1708433563286.png

 

Finally, add a Slicer visual to your report with the Parameter as its Field, and put the Parameter into any other visualization you want. Here I added it to a table:

Jonvoge_2-1708433636698.png

 

Happy report building!



_____________________________________________________
I hope my comment was helpful.
If your question was answered, please mark your post as 'Solved' and consider giving me a 'Thumbs Up'.

 

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.