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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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