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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Aho00
Regular Visitor

Chart without data

Hello, I need some help

I would like to count the rows from my data table and show them in a chart. And I want it to display 0 when there is no data for the one no showing up in my data table. My data starts from September and I use a calendar table.


The problem is when I choose "to show items without data" , it cuts the chart and it also show the chart from january to december even with a slicer while september is selected which I don't want.

Aho00_0-1763370152338.png

Aho00_1-1763370211755.png

 

And also by adding +0 to countrows (and removing "show items without data"). The chart is fine but it also start from January to December.
I want the chart to show me only the month that I selected from my slicer but it shows me also all the other months.

Aho00_2-1763370296037.png

Aho00_3-1763370332164.png


What I want (in green):

Aho00_4-1763370431829.png

 

Thanks for your help

 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @Aho00 

 

Adding 0 forces DAX to add 0 even for the rows that are not supposed to be there or within the slicer selection. Add a condition do your measure that checks whether a specific date is within the selected range

VAR _start =
    MINX ( ALLSELECTED ( CalendarTable ), CalendarTable[date] )
VAR _end =
    MAXX ( ALLSELECTED ( CalendarTable ), CalendarTable[date] )
RETURN
    IF (
        SELECTEDVALUE ( CalendarTable[date] ) >= _start
            && SELECTEDVALUE ( CalendarTable[date] ) <= _end,
        [your measure] + 0
    )

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

4 REPLIES 4
danextian
Super User
Super User

Hi @Aho00 

 

Adding 0 forces DAX to add 0 even for the rows that are not supposed to be there or within the slicer selection. Add a condition do your measure that checks whether a specific date is within the selected range

VAR _start =
    MINX ( ALLSELECTED ( CalendarTable ), CalendarTable[date] )
VAR _end =
    MAXX ( ALLSELECTED ( CalendarTable ), CalendarTable[date] )
RETURN
    IF (
        SELECTEDVALUE ( CalendarTable[date] ) >= _start
            && SELECTEDVALUE ( CalendarTable[date] ) <= _end,
        [your measure] + 0
    )

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hello,


Thanks for the answer, it works great!

Have a nice day.

alish_b
Super User
Super User

Hey @Aho00 ,

 

How many years of data do you have in your model? 

I can replicate  something similar to your case only in case where the data model spans for more than one year, so basically if I have October selected, the line chart spans from Oct 2020 to Oct 2021 with all the months in between (if I have data of 2022 and 2021). Is this the same case for you and do you want to show only months Oct 2020 and Oct 2021 side by side? 
Also, I am assuming that the slicer and the x-axis both come from the Calendar table.

Hello, I have a slicer for the month and one for the year. Technically, I just want to get a chart from a specific month from a specific year. And yes, I'm using the calendar table for the x-axis and for the slicer. But thanks for the answer, someone else gave me the answer and it works fine.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors
Top Kudoed Authors