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

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

Reply
JDC1993
New Member

Date table hierarchy not filtering dates properly

I've searched and searched to find a post with a similar issue, but I'm at a loss. Apologies if this has been answered before. 

 

I'm currently facing an issue where my date table hierarchy will not properly filter rows in a slicer, especially when used with ALLSELECTED in a measure. I know the hierarchy is to blame (at least partly), because everything works as it should when I use the 'Date'[Date] column in the slicer as opposed to the hierarchy. My date table is set up with a relationship to the main fact table bi-directionally and with many-to-one cardinality. My auto time intelligence is turned off.

 

Here is the measure I'm trying to get working:

 

Monthly Total Cost Variance (%) =
VAR CurrentMonthTotal =
    CALCULATE (
        SUM ( Analytics[Total Cost ($)] ),
        LASTDATE ( ALLSELECTED ( 'Date'[Date] ) ),
        ALLEXCEPT ( Analytics, Analytics[Account Number] )
    )
VAR PastMonthTotal =
    CALCULATE (
        SUM ( Analytics[Total Cost ($)] ),
        DATEADD ( LASTDATE ( ALLSELECTED ( 'Date'[Date] ) )-1MONTH ),
        ALLEXCEPT ( Analytics, Analytics[Account Number] )
    )
RETURN
    DIVIDE ( CurrentMonthTotal - PastMonthTotalPastMonthTotalBLANK () )

 

 

 

The desired behaviour is to have the measure display the variance for the most recent (filtered) month. If 'All' is selected in the slicer, it should display variances only for the most recent month, but with the hierarchy, it's will only display the most recent month, even if a month from the previous year is selected in the slicer. As I said, if I put the 'Date'[Date] column in the slicer instead, everything works as expected, so it has to be something with the way the hierarchy is constructed. 

 

Any help is greatly appreciated!

1 REPLY 1
Anonymous
Not applicable

Hi @JDC1993 ,

Could you please provide the related screenshots(mask the sensitive data) with visual settings(include Fields pane) and mark the wrong data with some explanation in order to make troubleshooting? Which field is applying on the slicer currently? It is from the date field of table Analytics? Thank you.

In addition, you can refer the content in the following blogs to get it.

Comparison- current month vs previous month

Current Month , Previous Month and Before Previous Month

How to use Date vs Date Hierarchy in Power BI

Best Regards

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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