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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
dw0012
New Member

Fromdate and Todates - how to use these fields to get results

I'm having a really hard time with fromdate / todate. I have a table that I created and a month-year slicer. 

 

The month-year slicer should return any data within the selected month that falls between the from and to dates. The month-year slicer is connected to a DATES table that has an active relationship from 'DATES'[date] to 'TABLE1'[fromdate] and an inactive relationship to to 'TABLE1'[todate]. Currently, when I select May 2024, it only pulls in May dates in the fromdate column as a test. 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@dw0012 Often the easiest way to do this is to use 2 disconnected date tables. You can then use a measure like this:

Measure = 
  VAR __FromDate = MAX( 'FromDates'[Date] )
  VAR __ToDate = MAX( 'ToDates'[Date] )
  VAR __Result = SUMX( FILTER( 'Table', [Date] >= __FromDate && [Date] <= __ToDate ), [Value] )
RETURN
  __Result

If that doesn't work, please provide more information. Also, you can watch this for more information on this kind of scenario:


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

1 REPLY 1
Greg_Deckler
Super User
Super User

@dw0012 Often the easiest way to do this is to use 2 disconnected date tables. You can then use a measure like this:

Measure = 
  VAR __FromDate = MAX( 'FromDates'[Date] )
  VAR __ToDate = MAX( 'ToDates'[Date] )
  VAR __Result = SUMX( FILTER( 'Table', [Date] >= __FromDate && [Date] <= __ToDate ), [Value] )
RETURN
  __Result

If that doesn't work, please provide more information. Also, you can watch this for more information on this kind of scenario:


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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