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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
MirkoCantatore
New Member

Date hierarchy custom range

Dear all,

I have a table with dates from Novembre 2017 and October 2018.

On April 2018 I have no data

Power BI Desktop has Time Intelligence option enabled and date hierarchy is fine.

Result is like that

image.png

 

As you can see no bar for April 2018.

If I choose "Show Items with no data", I get this

image.png

 

As you can see April is shown with no data, but I have other months I do not need (Jan-Oct 2017 and Nov-Dec 2018).

Is there a way to filter/customize the chart to show me only Nov 2017 - Oct 2018 and April 2018 (wih no data) like below?

Thanks

Kind regards

image.png

 

 

 

1 ACCEPTED SOLUTION
AkhilAshok
Solution Sage
Solution Sage

If you can create a Date table (if you don't already have one - you can just google "How to create Date Table in Power BI"), this can be easily achieved with some DAX:

 

Continuous Measure =
VAR MainMeasure =
    SUM ( 'Table'[Amount] )
VAR CurrentDate =
    MAX ( 'Calendar'[Date] )
VAR MaxDate =
    CALCULATE ( MAX ( 'Table'[Date] ), ALL ( 'Calendar' ) )
VAR MinDate =
    CALCULATE ( MIN ( 'Table'[Date] ), ALL ( 'Calendar' ) )
RETURN
    IF (
        ISBLANK ( MainMeasure )
            && CurrentDate <= MaxDate
            && CurrentDate >= MinDate,
        0,
        MainMeasure
    )

Here Table[Date] is the date column in your Fact/Data table, and Calendar[Date] is you Date dimension table, and you create a relationship between these 2.

View solution in original post

2 REPLIES 2
AkhilAshok
Solution Sage
Solution Sage

If you can create a Date table (if you don't already have one - you can just google "How to create Date Table in Power BI"), this can be easily achieved with some DAX:

 

Continuous Measure =
VAR MainMeasure =
    SUM ( 'Table'[Amount] )
VAR CurrentDate =
    MAX ( 'Calendar'[Date] )
VAR MaxDate =
    CALCULATE ( MAX ( 'Table'[Date] ), ALL ( 'Calendar' ) )
VAR MinDate =
    CALCULATE ( MIN ( 'Table'[Date] ), ALL ( 'Calendar' ) )
RETURN
    IF (
        ISBLANK ( MainMeasure )
            && CurrentDate <= MaxDate
            && CurrentDate >= MinDate,
        0,
        MainMeasure
    )

Here Table[Date] is the date column in your Fact/Data table, and Calendar[Date] is you Date dimension table, and you create a relationship between these 2.

Thank you very much.

It works.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors