The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have a table of commodity price time series data with the following columns:
Date (date of price observation)
Commodity
Period (delivery period for commodity)
Price
I would like to create a power BI page (which I can upload to the server) which allows the user to select two time series by selecting Commodity and Period for each series, and then plots the delta between the two prices on a chart. For example they might choose Jan-23 Wheat and Jan-24 Wheat and it would plot the difference between the two prices on each date.
I was reading about using parameters but apparently these cannot be published. Is there another way?
Solved! Go to Solution.
Hi @bluebottle81 ,
Please create a measure with below dax formula:
Measure =
VAR _a =
SELECTEDVALUE ( 'Table 2'[Period] )
VAR _b =
SELECTEDVALUE ( 'Table 3'[Period] )
VAR _c =
SELECTEDVALUE ( 'Table'[Commodity] )
VAR _d =
SELECTEDVALUE ( 'Table'[Date] )
VAR val1 =
CALCULATE (
MAX ( 'Table'[Price] ),
'Table'[Date] = _d,
'Table'[Period] = _a,
'Table'[Commodity] = _c
)
VAR val2 =
CALCULATE (
MAX ( 'Table'[Price] ),
'Table'[Date] = _d,
'Table'[Period] = _b,
'Table'[Commodity] = _c
)
RETURN
val2 - val1
Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @bluebottle81 ,
Please create a measure with below dax formula:
Measure =
VAR _a =
SELECTEDVALUE ( 'Table 2'[Period] )
VAR _b =
SELECTEDVALUE ( 'Table 3'[Period] )
VAR _c =
SELECTEDVALUE ( 'Table'[Commodity] )
VAR _d =
SELECTEDVALUE ( 'Table'[Date] )
VAR val1 =
CALCULATE (
MAX ( 'Table'[Price] ),
'Table'[Date] = _d,
'Table'[Period] = _a,
'Table'[Commodity] = _c
)
VAR val2 =
CALCULATE (
MAX ( 'Table'[Price] ),
'Table'[Date] = _d,
'Table'[Period] = _b,
'Table'[Commodity] = _c
)
RETURN
val2 - val1
Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Many thanks! So say I have data like the table below. Roughly what I'd be looking for is this:
Date | Commodity | Period | Price |
20-Jan-23 | Wheat | Jan-23 | 49.45 |
21-Jan-23 | Wheat | Jan-23 | 49.54 |
22-Jan-23 | Wheat | Jan-23 | 50.46 |
23-Jan-23 | Wheat | Jan-23 | 51.04 |
20-Jan-23 | Wheat | Jan-24 | 49.92 |
21-Jan-23 | Wheat | Jan-24 | 50.01 |
22-Jan-23 | Wheat | Jan-24 | 50.26 |
23-Jan-23 | Wheat | Jan-24 | 51.20 |
20-Jan-23 | Corn | Jan-23 | 38.19 |
21-Jan-23 | Corn | Jan-23 | 38.69 |
22-Jan-23 | Corn | Jan-23 | 39.68 |
23-Jan-23 | Corn | Jan-23 | 40.18 |
20-Jan-23 | Corn | Jan-24 | 39.01 |
21-Jan-23 | Corn | Jan-24 | 39.23 |
22-Jan-23 | Corn | Jan-24 | 39.61 |
23-Jan-23 | Corn | Jan-24 | 40.42 |
You can achieve it easily using 2 calendar tables.
Please attach some data table to work with and the desired result and I will show you how.
User | Count |
---|---|
85 | |
84 | |
36 | |
34 | |
32 |
User | Count |
---|---|
93 | |
79 | |
66 | |
55 | |
52 |