cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
OlegV
Helper I
Helper I

Show categories with no data on a chart

Hello, 

I need to recreate an Excel chart in PowerBI. I need to show dates without data (but excluding weekends.)

OlegV_0-1632126023671.png

But in PowerBI I get this result:

OlegV_2-1632126180005.png

Can you please help me.  

1 ACCEPTED SOLUTION
V-pazhen-msft
Community Support
Community Support

@OlegV 

You can create a new date column and use the new dates in the table visual and filter.

New Date =If(weekday([date],2)<=5, [date], Blank())

You might also need weekdays by create following 2 columns.

 

Weekday = if([New Date]<=5, [New Date] , Blank())


Text weekday = Switch([Weekday], 
1, "Mon",
2, “Tue",

3, "Wed",
4, "Thur",

5,"Fri",
Blank())


Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
V-pazhen-msft
Community Support
Community Support

@OlegV 

You can create a new date column and use the new dates in the table visual and filter.

New Date =If(weekday([date],2)<=5, [date], Blank())

You might also need weekdays by create following 2 columns.

 

Weekday = if([New Date]<=5, [New Date] , Blank())


Text weekday = Switch([Weekday], 
1, "Mon",
2, “Tue",

3, "Wed",
4, "Thur",

5,"Fri",
Blank())


Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thank you,
so as to show dates without data:
1) Create a Calendar table
2) Create a column with dates excluding Weekends using a function: DateNoWeekends =If(weekday('Calendar'[DateKey],2)<=5, 'Calendar'[DateKey], Blank())
3) Create a column with WeekDayNames using a function:  WeekdayDayName 
= 'Calendar'[DateKey] and format it as "ddd"

4) Plot WeekdayDayName  on x-axis, numerial values on y-axis and filter a visual with DateNoWeekends.

amitchandak
Super User
Super User

@OlegV , You need a date table for that.

You can add +0 then it will show all the dates

 

You need to create measure like

 

0 between range
Measure = var _1= [Price MT] +0 // assume you have a measure [Price MT] 
var _min = minx(ALLSELECTED('Calendar'), 'Calendar'[Date])
var _max = maxx(ALLSELECTED('Calendar'), 'Calendar'[Date])
return
CALCULATE(if(max('Calendar'[Date]) <_min || max('Calendar'[Date])  &&'Calendar'[Weekday] =1  >_max , BLANK(), _1))

 

 

column in calendar

 

 

Weekday = if( WEEKDAY([Date],2) >6,0,1)

 

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 :radacad sqlbi My Video Series Appreciate your Kudos.

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin

Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

@amitchandak Thank you for your reply.
It shows a mistake:

OlegV_0-1632133226902.png

I did not mention, I have a page filter where I choose the dates for which to show the data.

OlegV_0-1632134121970.png

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.