Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have two tabels.
One with historic values of an asset and one with asset purchases.
I want to get the historic values of the asset purchases based on a what if parameter preferably using a measure.
For example if the what if parameter is 5 i would like to get the historic value 5 days earlier. Sometimes there won't be a historic value that specific date and then i would like to get the value of the first date before that date (for example 6 days earlier).
Below are the structure of the tables.
Historic values table:
Asset ID
Date
Price
Asset purchases table:
Asset ID
Transaction date
Price
Solved! Go to Solution.
Try
Historic price =
VAR WhatIf = [What if value]
RETURN
SUMX (
'Asset purchases',
SELECTCOLUMNS (
TOPN (
1,
FILTER (
'Historic values',
'Historic values'[Asset ID] = 'Asset purchases'[Asset ID]
&& 'Historic values'[Date] <= 'Asset purchases'[Date] - WhatIf
),
'Historic values'[Date]
),
"@value", 'Historic values'[Price]
)
)
Thanks 🙂
Try
Historic price =
VAR WhatIf = [What if value]
RETURN
SUMX (
'Asset purchases',
SELECTCOLUMNS (
TOPN (
1,
FILTER (
'Historic values',
'Historic values'[Asset ID] = 'Asset purchases'[Asset ID]
&& 'Historic values'[Date] <= 'Asset purchases'[Date] - WhatIf
),
'Historic values'[Date]
),
"@value", 'Historic values'[Price]
)
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
44 | |
28 | |
21 | |
12 | |
8 |
User | Count |
---|---|
74 | |
51 | |
45 | |
16 | |
12 |