Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Greetings!
I have a requirement for price tracking. I have tables with history of prices like this:
Also i have table with dates(calendar). So, i tried to calculate last price on selected date:
[[S]] changing 200-300] =
VAR Last_date =
CALCULATE(
MAX('[S] products wholesale_prices_history'[changing_date]),
FILTER(
ALL('[TIMELINE] Date params'),
'[TIMELINE] Date params'[Date]<=MAX('[TIMELINE] Date params'[Date])))
RETURN
SELECTCOLUMNS(
FILTER(
CALCULATETABLE('[S] products wholesale_prices_history', ALL('[TIMELINE] Date params')),
'[S] products wholesale_prices_history'[changing_date]=Last_date
),
"Price",
MAX('[S] products wholesale_prices_history'[price])
)
Great, last price in selected date. But now i select 15.06.2023 or earlier, it gives me an error because more than 1 value got.
case 2:
VAR Last_date =
CALCULATE(
MAX('[M] ozon prices_history'[changing_date]),
FILTER(
ALL('[TIMELINE] Date params'),
'[TIMELINE] Date params'[Date]<=MAX('[TIMELINE] Date params'[Date]))
)
RETURN
IF(
CALCULATE(HASONEVALUE('[M] ozon prices_history'[article]), ALL('[TIMELINE] Date params')),
SELECTCOLUMNS(
FILTER(
CALCULATETABLE('[M] ozon prices_history', ALL('[TIMELINE] Date params')),
'[M] ozon prices_history'[changing_date]=Last_date
),
"Price",
[price]
),
"Choose product")
Hi @Sergey_Bakaev it seems from your formulas that you do not need column changing_time? If yes, remove column from your table (do not import it via Power Query or something like that) and see your results. Hope this help
Proud to be a Super User!
Hello @some_bih , thank you for your advice, but I think I will need this in order to filter the last time of the date that is selected. Correct me if I'm wrong.
All the best
Hi @Sergey_Bakaev in your picture wanted solution include article and date so time (hours and minutes) is not relevant. Hours and minutes are the lowest level of data so does not make sense to get some solution for that level of data as it can be easly filtered by date or article. So if you want to get the last time for some date then there is featues alreday - simple filter. This is the reason I "suggest" you to remove time column, if you want some solution using DAX. Hope this help
Proud to be a Super User!
I understood you. OK, I will stop using the column over time in the future.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Ask questions in Eventhouse and KQL, Eventstream, and Reflex.
User | Count |
---|---|
85 | |
83 | |
66 | |
61 | |
58 |
User | Count |
---|---|
194 | |
111 | |
105 | |
79 | |
71 |