Forum Discussion

MG25's avatar
MG25
Regular Visitor
5 years ago
Solved

Filter by date periods

Hi,   I'm new to Power BI and I am hoping someone could help me out with what I thought would have been simple. It turns out it's not so simple if you don't know how.   I have a query that has a ...
  • Portrek's avatar
    5 years ago

    hi, MG25

    You can use the measure below

     

     

    measure = 
        CALCULATE(
            COUNTROWS('Table'),
                DATEDIFF('Table'[Product Date of Manufacture],
                    'Table'[Product Return Date],
                    DAY
            )<365
    )

     

     

    best regards.

  • Fowmy's avatar
    5 years ago

    MG25 

    I recommend you to create a date table in your model if you don't have one and create a relationship. Add the following measure and insert a Matrix visual.  I attached a sample file.

    Less than one year = 
    COUNTROWS(
        FILTER(
            Table5,
            INT( Table5[Product Return Date]  -  Table5[Product Date of Manufacture] ) < 365
        )
    )