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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
MDLO
New Member

Visualise data from last 7 days even if there is no data for a certain day

Hello,

 

I am new to power bi and am experiencing some trouble which I can't seem to solve with Google's help.

I have a dataset where each line is a notification made together with the date the notification is made.

 

There are days where no notification is made. I want to visualise for the last 7 days how many notifications were made per day. For that I have added a column with the value 1 if the notification is made in the last 7 days and the value 0 if it is older. But the dates that don't have a notification are not shown.

 

DayNotificationLast 7 days
18/1/2022dddd1
17/1/2022cccc1
16/1/2022bbbb1
10/1/2022aaaa0

 

 

What I get when I try to visualize:

MDLO_0-1642605907451.png

 

What I want:

MDLO_1-1642606038452.png

 

Anyone knows how to deal with this?

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @MDLO,

Did you mean to create a calculated column to remark the last 7 days based on the current system date? If that is the case, you can refer to the following expressions:

Is Last 7 day = 
IF ( 'Table'[Date] IN GENERATESERIES ( TODAY () - 6, TODAY () ), 1, 0 )

BTW, you can't achieve the effect as second graph. Power bi will auto-hide the data label which has zero values. Perhaps you can use some default values instead of zero to keep the axis date range displayed.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @MDLO,

Did you mean to create a calculated column to remark the last 7 days based on the current system date? If that is the case, you can refer to the following expressions:

Is Last 7 day = 
IF ( 'Table'[Date] IN GENERATESERIES ( TODAY () - 6, TODAY () ), 1, 0 )

BTW, you can't achieve the effect as second graph. Power bi will auto-hide the data label which has zero values. Perhaps you can use some default values instead of zero to keep the axis date range displayed.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
parry2k
Super User
Super User

@MDLO you need add a date dimension in your model and use that on x-axis, to add one, you can follow my blog post here Create a basic Date table in your data model for Time Intelligence calculations | PeryTUS IT Solutio...

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k thanks for the quick reply. I managed to set the Date table up until the last step: the relationships.

 

In my table (notifications list) I have 2 dates: "Datum_melding" (= this is de date of the notification) and "Flow_completedb" (= when notification was closed).

 

First issue:

When linking "Date' to "Flow_completedb" I get no issues/errors

MDLO_0-1642698993132.png

 

When trying to connect "Date" to "Datum_melding" I get the following error:

MDLO_1-1642699041493.png

 

MDLO_2-1642699158171.png

 

Second issue:

When I try to visualise with the date 'Flow_completedb" (which is already linked), I still get the same result.

MDLO_3-1642699352446.png

 

Any ideas on how to solve?

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.