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

View all the Fabric Data Days sessions on demand. View schedule

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
Continued Contributor
Continued Contributor

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors