Forum Discussion

ns4321's avatar
ns4321
Frequent Visitor
3 years ago

Create a filtered DAX table based on date slicer

Hi,

 

I am trying to create a DAX that gives a filtered table based on date range selected in the slicer. 

 

 

 

Filtered_Table = 

var minDR = min('Calendar'[Date])
var maxDR = max('Calendar'[Date])

return Filter(Sales,DATESBETWEEN(Sales[Date],minDR,maxDR)

 

 


But I am getting this error:

 

The PBIX I used is the Microsfot's sample: https://github.com/microsoft/powerbi-desktop-samples/blob/main/Sample%20Reports/Sales%20%26%20Returns%20Sample%20v201912.pbix

What am I doing wrong? My intention is to create filtered table, then summarize it and create additional DAX measures. But getting lost at this step. 

 

Appreciate if anyone can help. 

 

Thanks

 



2 Replies

  • Hi,

    Why do you want to create a filterd table?  Just drag Date from the Calendar Table and select any date range.  Then write this measure

    Total = sum(Data[Sales])

    Hope this helps.

  • ns4321's avatar
    ns4321
    Frequent Visitor

    Thanks Ashish_Mathur . But I need to do many additional steps on this filtered table - summarize, find top N, pull non Top N as "others", etc. So I want to be able to do this in a DAX.