Forum Discussion
BhavyaM
Helper V
6 years agoLive price
Hi,
I want to show live Oil price.
I have Oil price, daily date and material name fields. Using these fields I want to show live price.
if there is any price today then we have to show today Live price. Else previous price value.
can you please help me how to do this
This is very urgent requirement
Thanks in advance.
4 Replies
- amitchandak
Super User
BhavyaM , Not very clear. If you have some API, you can get the data and show it.
- v-yingjl
Community Support
Hi BhavyaM ,
I have created a sample table:
Create a measure like this:
Live price = IF ( SELECTEDVALUE ( 'Table'[Material name] ) = "A" && SELECTEDVALUE ( 'Table'[Daily date] ) = TODAY (), "Live price of A is today: " & CALCULATE ( SUM ( 'Table'[Oil price] ), 'Table'[Material name] = "A", 'Table'[Daily date] = TODAY () ), IF ( SELECTEDVALUE ( 'Table'[Material name] ) = "A" && SELECTEDVALUE ( 'Table'[Daily date] ) <> TODAY (), "Live price of A is previous: " & CALCULATE ( SUM ( 'Table'[Oil price] ), FILTER ( 'Table', 'Table'[Material name] = "A" && 'Table'[Daily date] = CALCULATE ( MAX ( 'Table'[Daily date] ), FILTER ( 'Table', 'Table'[Material name] = "A" && 'Table'[Daily date] < TODAY () ) ) ) ), IF ( SELECTEDVALUE ( 'Table'[Material name] ) = "B" && SELECTEDVALUE ( 'Table'[Daily date] ) = TODAY (), "Live price of B is today: " & CALCULATE ( SUM ( 'Table'[Oil price] ), 'Table'[Material name] = "B", 'Table'[Daily date] = TODAY () ), IF ( SELECTEDVALUE ( 'Table'[Material name] ) = "B" && SELECTEDVALUE ( 'Table'[Daily date] ) <> TODAY (), "Live price of B is previous: " & CALCULATE ( SUM ( 'Table'[Oil price] ), FILTER ( 'Table', 'Table'[Material name] = "B" && 'Table'[Daily date] = CALCULATE ( MAX ( 'Table'[Daily date] ), FILTER ( 'Table', 'Table'[Material name] = "B" && 'Table'[Daily date] < TODAY () ) ) ) ), IF ( SELECTEDVALUE ( 'Table'[Material name] ) = "C" && SELECTEDVALUE ( 'Table'[Daily date] ) = TODAY (), "Live price of C is today: " & CALCULATE ( SUM ( 'Table'[Oil price] ), 'Table'[Material name] = "C", 'Table'[Daily date] = TODAY () ), IF ( SELECTEDVALUE ( 'Table'[Material name] ) = "C" && SELECTEDVALUE ( 'Table'[Daily date] ) <> TODAY (), "Live price of C is previous: " & CALCULATE ( SUM ( 'Table'[Oil price] ), FILTER ( 'Table', 'Table'[Material name] = "C" && 'Table'[Daily date] = CALCULATE ( MAX ( 'Table'[Daily date] ), FILTER ( 'Table', 'Table'[Material name] = "C" && 'Table'[Daily date] < TODAY () ) ) ) ), BLANK () ) ) ) ) ) )Use two slicers and a card visual to show the result:
Attached my sample file that you can refer: Live price.pbix
Best Regards,
Yingjie LiIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.