Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi All,
I have a two tables with data as shown below
I wish to write a function that will return the value from the first table where the date is an exact match or the last occurence before dateOn. For instance CAM1 at dateOn 02/01/2011 would return value 43 and CAM6 at dateOn 05/01/2011 would return value 437
Any help is greatly appreciated. Thanks!
Solved! Go to Solution.
Hi @Anonymous
Could you show me the screenshot?Please check the formula <=.Please make sure there's no relationship between the two tables.
Column = CALCULATE ( SUM ( 'First Table'[values] ), TOPN ( 1, FILTER ( 'First Table', 'First Table'[filed_name] = 'Second Table'[f_name] && 'First Table'[date] <= 'Second Table'[dateOn] ), 'First Table'[date], DESC ) )
Regards,
Cherie
Hi @Anonymous
You may try below calculated column.
Column = CALCULATE ( SUM ( 'First Table'[values] ), TOPN ( 1, FILTER ( 'First Table', 'First Table'[filed_name] = 'Second Table'[f_name] && 'First Table'[date] <= 'Second Table'[dateOn] ), 'First Table'[date], DESC ) )
Regards,
Cherie
Thanks Cherie for your quick reply.
Somehow, the calculated colum returns just the values where the dates is an exact match.
Typed the formula exactly. Don't know if am missing something.
Hi @Anonymous
Could you show me the screenshot?Please check the formula <=.Please make sure there's no relationship between the two tables.
Column = CALCULATE ( SUM ( 'First Table'[values] ), TOPN ( 1, FILTER ( 'First Table', 'First Table'[filed_name] = 'Second Table'[f_name] && 'First Table'[date] <= 'Second Table'[dateOn] ), 'First Table'[date], DESC ) )
Regards,
Cherie
There was a relationship between the tables.
Thanks, it works like a charm
Regards
User | Count |
---|---|
141 | |
113 | |
104 | |
78 | |
64 |
User | Count |
---|---|
136 | |
125 | |
107 | |
70 | |
61 |