Forum Discussion
Differences in using dates from FACT TABLE and DIMENSION TABLE
- 3 years ago
Hi,
Please find attached the PBI file.
Hope this helps.
- 3 years ago
inmingoon I believe this is what you are looking for, basically, you need to work with the date table in each expression:
Max PRICE = VAR SLT_DAT = MAX ( 'Date'[DATE] ) VAR SUM_TBL = SUMMARIZE ( 'DATA', 'SYMBOL'[NAME] ) VAR PRC_DAT = CALCULATE ( MAX ( 'PRICE'[DATE] ), FILTER ( ALLSELECTED ( 'DATE'[Date] ), 'DATE'[DATE] <= SLT_DAT ), SUM_TBL ) VAR result = CALCULATE ( MAX ('PRICE'[PRICE] ), SUM_TBL, 'Date'[DATE] = PRC_DAT ) return result - 3 years ago
inmingoon you can also take advantage of the LASTNONBLANKVALUE function, Check the video here LASTNONBLANKVALUE and Missing Data - Power BI - YouTube
Max PRICE 2 = VAR SUM_TBL = SUMMARIZE ( 'DATA', 'SYMBOL'[NAME] ) VAR result = CALCULATE ( LASTNONBLANKVALUE ( 'Date'[DATE], SUM ( 'PRICE'[PRICE] ) ), SUM_TBL, FILTER ( ALLSELECTED ( 'DATE'[Date] ), 'DATE'[DATE] <= MAX ( 'DATE'[DATE] ) ) ) return result
Hi,
Please find attached the PBI file.
Hope this helps.
Thank you so much for your help.
You applied the "calculate" formula in the row context.
I'm afraid that might demand a lot of resources on a large fact table.
So I'm asking if there is another way to implement it without context transition.
Actually, I'm frustrated because I don't understand why the measure I've created works well in picture #1 but not in picture #2.
Thanks again for your comments.