cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

New Member

## Filter Table by Selected Quarter (mindate / maxdate)

Hi

Am trying to create a calculated table with filter on selected dates (Quarter mindate and maxdate).

and my DAX is as follows:

filteredbyQtr =
VAR mindate =
MIN ( 'Date'[Date] )
VAR maxdate =
MAX ( 'Date'[Date] )
VAR result =
CALCULATETABLE (
Sales,
FILTER ( sales, Sales[SaleDate] >= mindate && Sales[SaleDate] <= maxdate )
)
RETURN
result

But seems this doesnt work... always returns full records.

1 ACCEPTED SOLUTION
Community Support

Hi @PBIDataNerd ,

Tables and columns in PBI are ALWAYS STATIC.They're recalculated when data is refreshed.

Measures are dynamic and the value will change with slicer or other filtering methods.

You can try to apply the following measure =1 in the visual level filter as workaround:

``````filteredbyQtr =
VAR mindate =
MIN ( 'Date'[Date] )
VAR maxdate =
MAX ( 'Date'[Date] )
RETURN
IF(MAX('SALES'[SaleDate])>=mindate &&MAX('SALES'[SaleDate])<=maxdate,1,0)``````

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 REPLIES 4
Community Support

Hi @PBIDataNerd ,

Tables and columns in PBI are ALWAYS STATIC.They're recalculated when data is refreshed.

Measures are dynamic and the value will change with slicer or other filtering methods.

You can try to apply the following measure =1 in the visual level filter as workaround:

``````filteredbyQtr =
VAR mindate =
MIN ( 'Date'[Date] )
VAR maxdate =
MAX ( 'Date'[Date] )
RETURN
IF(MAX('SALES'[SaleDate])>=mindate &&MAX('SALES'[SaleDate])<=maxdate,1,0)``````

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Super User

@PBIDataNerd , You can not use Slicer values in a new calculated table.

New Member

hmm.. is there a way to just show only the dates which got sale and are within the selected quarter.

Super User

@PBIDataNerd , Only in visual tables using measures.

Variable using var in dax measure can have calculatedtable using slicer value

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

#### Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors