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
ChristineB
Frequent Visitor

DATESINPERIOD filter not working

Hi
I am trying to calculate the sum of my optimal load qty (VAR a) for the previous 90days. I have the following formua but it does not seem to be filtering correctly for the date range:

 

PAR MAX Dispatch Qty P90D =

VAR a =

    CALCULATE (

        MINX ( TOPN ( 1, fact_PAR, [PAR Net Margin/Flight], DESC ), fact_PAR[Value] )

    )

RETURN

    SUMX (

        SUMMARIZE (

            'dim_perishable sell through',

            'dim_perishable sell through'[Flight Key],

            'dim_perishable sell through'[Item Name],

            "PAR MAX value P90D",

                CALCULATE (

                    a,

                    DATESINPERIOD ( dim_date[Date], LASTDATE ( dim_date[Date] ), -91, DAY )

                )

        ),

        [PAR MAX value P90D]

    )

Can anyone please help?

5 REPLIES 5
Anonymous
Not applicable

Hi @ChristineB ,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

ChristineB
Frequent Visitor

Thank you but it is still not filtering on date range. It is calculating for just the selected date,

please share your sample pbix file, and then I can try to look into it.

thanks.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Unfortunately I don't have a sample pbix file to share. Is there any other information I could provide to assist?

I have a date table with a column dim_date[Date] with a 1:many relationship with a date column in my dim_perishable sell through[dep date].

There are no relationships with the fact_PAR table. 

Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but try something like below whether it suits your requirement.

 

PAR MAX Dispatch Qty P90D =
SUMX (
    SUMMARIZE (
        'dim_perishable sell through',
        'dim_perishable sell through'[Flight Key],
        'dim_perishable sell through'[Item Name],
        "PAR MAX value P90D",
            CALCULATE (
                MINX ( TOPN ( 1, fact_PAR, [PAR Net Margin/Flight], DESC ), fact_PAR[Value] ),
                DATESINPERIOD ( dim_date[Date], LASTDATE ( dim_date[Date] ), -91, DAY )
            )
    ),
    [PAR MAX value P90D]
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.