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
Gabe_07
Helper I
Helper I

Catch the 7 Days with data

Hello,

 

        I've trying to build a Line Clustered Column Chart that shows the 7 days (columns) with data, if it doesn't have data does not count. I'd appreciate any ideas.
My codes:
SHARED AXIS = 

Week Day = FORMAT(BatchHeaders[ActualEndDate], "d - mmm")
COLUMN VALUES = 
7 days rolling = CALCULATE(
                        SUM(BatchHeaders[Batch Weight]),
                        DATESINPERIOD(BatchHeaders[ActualEndDate].[Date], LASTDATE(BatchHeaders[ActualEndDate].[Date]), -7, DAY))
 
EXAMPLE.png
 
My goal is to get something like, and filter with the other visuals on the page
 
THANK YOU
Gabriel Molina
 



2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Gabe_07 , In case you use want last seven days, use relative date slicer.

https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

 

In case you want to have with date use.

https://www.youtube.com/watch?v=duMSovyosXE

 

or like

Rolling 7 day = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],MAX(Sales[Sales Date]),-7,Day))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...


Appreciate your Kudos.

View solution in original post

v-kelly-msft
Community Support
Community Support

Hi @Gabe_07

 

If the dates are not continuous,you'd better use TOPN function to first calculate the top 7 dates which is ahead of the selected dates.Then you will get the sum value you need.

 

 

 

 
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

View solution in original post

3 REPLIES 3
v-kelly-msft
Community Support
Community Support

Hi @Gabe_07

 

If the dates are not continuous,you'd better use TOPN function to first calculate the top 7 dates which is ahead of the selected dates.Then you will get the sum value you need.

 

 

 

 
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
amitchandak
Super User
Super User

@Gabe_07 , In case you use want last seven days, use relative date slicer.

https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

 

In case you want to have with date use.

https://www.youtube.com/watch?v=duMSovyosXE

 

or like

Rolling 7 day = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],MAX(Sales[Sales Date]),-7,Day))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...


Appreciate your Kudos.

@amitchandak  Sorry for the delay, I found your replies awesome that gave me ideas to improve the pages. I created an slicer with 4 periods of time. Thank you

@v-kelly-msft  Thank you for your solution kelly, that was the main idea with the Line and Clustered column Chart 

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.