Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Filter Data Between daterange

I attempted to follow this thread on this channel but I think my issue is easier.

 

I have the below table (dates) that shows the beginning and ending of a month

StartDateEndDate
01/10/202031/10/2020
01/11/202030/11/2020

 

My other table (sales) has a date between these ranges

DateAmountStore
08/10/202088StoreA
11/10/202092StoreB
05/11/2020110StoreA

 

I would like a date slicer that returns the sum based on filtered data in table (Sales)

 

Q1. Would it best to use a SUMX aggregrator? 

 

Q2. How could I create a relationship between these two tables based only on the daterange?

 

I am a little stuck and would appreciate the help.

2 ACCEPTED SOLUTIONS
camargos88
Community Champion
Community Champion

Hi @Anonymous,

 

You don't need a table with start and end. You can create just a date table and relate them.

 

Use a slicer, you are gonna have the start/end dates to filter. Also, you can create more columns on your date table like month/year and use it on slicers.

 

Check this file: Download PBIX 

 

Did I answer your question? Mark my post as a solution!
Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

Hi @Anonymous ,

 

Capture.PNG

Capture 1.PNG

 

This is just an example, there are many ways to create the date table.

 

Ricardo

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

6 REPLIES 6
camargos88
Community Champion
Community Champion

Hi @Anonymous,

 

You don't need a table with start and end. You can create just a date table and relate them.

 

Use a slicer, you are gonna have the start/end dates to filter. Also, you can create more columns on your date table like month/year and use it on slicers.

 

Check this file: Download PBIX 

 

Did I answer your question? Mark my post as a solution!
Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

Thanks for the help on this one. It was driving me a bit mad.

 

Can I check the process you did to create the Date Table? I want to recycle your code e.g. 

Date = CALENDAR(EOMONTH(MIN(Sales[Date]). -1) +1, EOMONTH(MAX(Sales[Date]), 0))

Thank you 

Hi @Anonymous,

 

Sure.

 

The function CALENDAR receives 2 parameters (start and end dates), the code just get the min and max of your sales date and the function EOMONTH returns the end of the month with the number of months you need.

Example:

EOMONTH(MIN(Sales[Date]). -1) +1

This one goes to the end of the min month of your sales tables, but the parameter is -1, so it will go back 1 month. Also it's adding 1 day to this date.

Min Date => 2020-01-01

EOMONTH => 2020-01-31 // This is the same as EOMONTH(MIN(Sales[Date]); -0))

EOMONTH with -1 => 2019-12-31

(EOMONTH with -1) + 1 =>  2019-12-31 + 1 => 2020-01-01

 

https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions

https://docs.microsoft.com/en-us/dax/calendar-function-dax

 

Also check this link for time-intel functions, you can enrich you report with them:

https://docs.microsoft.com/en-us/dax/time-intelligence-functions-dax

 

Ricardo

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

Thanks Ricardo.

 

What is the best way to create the data table? Do I just press the entre data option in the Home>Data icon?

 

Can you share the steps you did to create this data table. This was what I was trying to ask. Sorry I was not clear.

 

Thanks for those articles I will ingest them 🙂

Anonymous
Not applicable

Oh I think you shared that article https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

 

Can you share that code snippet?

Hi @Anonymous ,

 

Capture.PNG

Capture 1.PNG

 

This is just an example, there are many ways to create the date table.

 

Ricardo

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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