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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
rogerdea
Helper IV
Helper IV

Comparing Dates between tables

I am struggling to figures out how to compare dates between tables. So any help with best approach is appreciated.  I've tried RELATED function but that wont work.

 

The context is locations are open on certain dates throughout the year [DatesOpen] but not every day, and each location should submit an activity form for each of those days [FormsReceived].  I am trying to determine which dates I am missing forms for.

 

Hopefully the image below is not too small, but i have a 1 to many relationship between the two tables (its a 'many' as there may be NULL dates in there which is bad data), and want to produce a table showing which daes have forms received and which dates dont:

 

rogerdea_4-1688808076356.png

 

rogerdea_3-1688807925696.png

 

rogerdea_6-1688808163777.png

 

Any ideas how to go about doing this?  Been trying for ages and getting nowhere!

 

Thanks

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @rogerdea ,

 

Here are the steps you can follow:

1. Create calculated table.

Flag =
var _table1=
SUMMARIZE(
    'DatesOpen',
    'DatesOpen'[DateOpen],'DatesOpen'[Location],'DatesOpen'[CompKey],
    "DateFrom",
    MAXX(      FILTER(ALL(FormsReceived),'FormsReceived'[CompKey]=EARLIER('DatesOpen'[CompKey])),'FormsReceived'[DateOpen]),
    "FromOutstanding",
    IF(
        'DatesOpen'[CompKey] in SELECTCOLUMNS('FormsReceived',"1",'FormsReceived'[CompKey]),0,1))
return
SUMMARIZE(
    _table1,[DateOpen],[DateFrom],[FromOutstanding])

2. Result:

vyangliumsft_0-1688976515804.png

 

 

Best Regards,

Liu Yang

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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi  @rogerdea ,

 

Here are the steps you can follow:

1. Create calculated table.

Flag =
var _table1=
SUMMARIZE(
    'DatesOpen',
    'DatesOpen'[DateOpen],'DatesOpen'[Location],'DatesOpen'[CompKey],
    "DateFrom",
    MAXX(      FILTER(ALL(FormsReceived),'FormsReceived'[CompKey]=EARLIER('DatesOpen'[CompKey])),'FormsReceived'[DateOpen]),
    "FromOutstanding",
    IF(
        'DatesOpen'[CompKey] in SELECTCOLUMNS('FormsReceived',"1",'FormsReceived'[CompKey]),0,1))
return
SUMMARIZE(
    _table1,[DateOpen],[DateFrom],[FromOutstanding])

2. Result:

vyangliumsft_0-1688976515804.png

 

 

Best Regards,

Liu Yang

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

Ashish_Mathur
Super User
Super User

Hi,

In the Result table, why not show only 2 columns - Date and FormOutstanding?  If you are amenable to my approach, then share data in format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Arul
Super User
Super User

@rogerdea ,

Are you expecting this?

New Table = 
VAR _tempTable = SUMMARIZE('Date Open','Date Open'[DateOpen],'Date Form'[DateForm])
RETURN ADDCOLUMNS(_tempTable,"FormOutstanding",IF('Date Form'[DateForm]<>BLANK(),0,1))

Thanks,

Arul





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

Proud to be a Super User!


LinkedIn


Thanks for the reply, but in the _tempTable and SUMMARIZE i cannot get the 'Date Form'[DateForm] in there, as  it does not show in the list of available fields to pick from.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon & SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.