cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

choose the column based on the current date

Hello gurus

 

I would like to create a report that would show a diagram similar to

saeedrahimi99_0-1614296908817.png

 

those 3 bars represent the values of Previous week, This week and Next week against the left column.

 

saeedrahimi99_1-1614296908822.png

Does Power BI offer any functionality to be able to check the current date and determine which column represents the column for the Current week and use the previous column and the next column to come up with those bar graphs?

If so please point me in the right direction

Source of data is a CSV file.

 

Thanks

1 ACCEPTED SOLUTION

Once you have your CSV imported, right-click on the table and choose New Column and type the code in from above for Diff, replacing DateField with whatever your column name is for the date.

 

When you make your visual - if you're doing a Clustered Bar Chart, choose Diff as your Axis and then put the other column(s) in the Values field. Then set the filter on Diff to Advanced Filtering - is less than or equal to 7, and is more than or equal to 0.

 

By putting the calculated field in the Axis, you're ensuring that the reports you get are all based on the timeframe you decide from today's date.

View solution in original post

3 REPLIES 3
viviank
Resolver I
Resolver I

You can create a calculated column to get the difference between today's date and the date in your table. For example:

Diff = 'Table'[DateField]-TODAY()
Then you build your visual, and set a filter on Diff. If you want to show just everything for the next week, set a filter for Diff for between 0 and 7.
Anonymous
Not applicable

please point me into how I can do all this scripting in my power bi report. Thanks

Once you have your CSV imported, right-click on the table and choose New Column and type the code in from above for Diff, replacing DateField with whatever your column name is for the date.

 

When you make your visual - if you're doing a Clustered Bar Chart, choose Diff as your Axis and then put the other column(s) in the Values field. Then set the filter on Diff to Advanced Filtering - is less than or equal to 7, and is more than or equal to 0.

 

By putting the calculated field in the Axis, you're ensuring that the reports you get are all based on the timeframe you decide from today's date.

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors