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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Calculating Min/Max date columns based on selected values

Hi Experts

 

I am getting the following error on my date filter range on mini and max in the following DAX, cannot see wood for the trees. i have tried to add format and value to resolve teh issues unless i am doing something wrong, created a second column in my date table call date 2 using = format (calendar[date], "dd/mm/yyyy") and still no luck, changed the local to uk as well and still no luck.

 

Report Filter = 
    VAR oL = "DIMSalesPerson/OfficeLocation eq '" & SELECTEDVALUE('DIMSalesPerson'[OfficeLocation]) & "'" 
    VAR oC = "DIMSalesPerson/City eq '" & SELECTEDVALUE('DIMSalesPerson'[City]) & "'" 
    VAR oS  = "DIMShipper/ShipCompanyName eq '" & SELECTEDVALUE('DIMShipper'[ShipCompanyName]) & "'"
    VAR oP = "DIMProduct/CategoryName eq '" & SELECTEDVALUE('DIMProduct'[CategoryName]) & "'"
    VAR oSP = "DIMSalesPerson/SalesPerson eq '" & SELECTEDVALUE('DIMSalesPerson'[SalesPerson]) & "'"
    VAR oRegion = "DIMSalesPerson/SalesRegion eq '" & SELECTEDVALUE('DIMSalesPerson'[SalesRegion]) & "'"
    VAR oDatefilter = IF(ISFILTERED('Calendar'[Date]), "Calendar/Date le "  & MAX('Calendar'[Date]) & " and Calendar/Date ge " & MIN('Calendar'[Date]))
    RETURN

    [Report URL] & 
    SWITCH(
        TRUE,
            ISFILTERED('DIMSalesPerson'[OfficeLocation]) &&  ISFILTERED('DIMSalesPerson'[City]), "?filter=" & oL & " and " & oC & " and " & oS & " and " & oP & " and " & oSP & " and " & oRegion & " and " & oDatefilter,
            ISFILTERED('DIMSalesPerson'[OfficeLocation]), "?filter=" & oL, 
            ISFILTERED('DIMSalesPerson'[City]), "?filter=" & oC,
            ISFILTERED('DIMShipper'[ShipCompanyName]), "?filter=" & oS,
            ISFILTERED('DIMProduct'[CategoryName]), "?filter=" & oP,
            ISFILTERED('DIMSalesPerson'[SalesPerson]), "?filter=" & oSP,
            ISFILTERED('DIMSalesPerson'[SalesRegion]), "?filter=" & oRegion,
            IF(ISFILTERED('Calendar'[Date]), "Calendar/Date le "  & MAX('Calendar'[Date]) & " and Calendar/Date ge " & MIN('Calendar'[Date]))
        
        )

Capture.PNG

1 REPLY 1
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

It seems the visible part of [Report Filter] has correct syntax.

How do you calculate for [Report URL]?

 

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
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!

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