Search code examples
powerbidaxpowerquerypowerbi-desktopm

PowerBI - How to select a specified date range


PowerBI - How to select a specified date range to keep only those rows in PowerBI I want to select a date range from 01/03/24 to 01/04/24 (as an example date range).

I have tried the following.

FILTER(
    'formfull',
    'formfull'[upLoad_output] >= DATE(2024, 1, 1) && 'formfull'[upLoad_output] <= DATE(2024, 12, 31)
)

This errors to the following.

"Total Literal expected"

enter image description here


Solution

  • You're trying to use DAX when you need to use M in Power Query. If your column is a date, select the filter in the column header and then between.

    enter image description here

    It generates code as follows:

    = Table.SelectRows(#"Changed Type", each [Date] >= #datetime(2024, 1, 10, 0, 0, 0) and [Date] <= #datetime(2024, 1, 12, 0, 0, 0))