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
OlegV
Helper II
Helper II

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.

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.

@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
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.

Top Solution Authors