Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
bluebottle81
Frequent Visitor

Chart comparing two user selected series

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?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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

vbinbinyumsft_0-1691562337136.png

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.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

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

vbinbinyumsft_0-1691562337136.png

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.

bluebottle81
Frequent Visitor

Many thanks! So say I have data like the table below. Roughly what I'd be looking for is this:

 

bluebottle81_0-1691387368053.png

 

 

 

 

DateCommodityPeriodPrice
20-Jan-23WheatJan-2349.45
21-Jan-23WheatJan-2349.54
22-Jan-23WheatJan-2350.46
23-Jan-23WheatJan-2351.04
20-Jan-23WheatJan-2449.92
21-Jan-23WheatJan-2450.01
22-Jan-23WheatJan-2450.26
23-Jan-23WheatJan-2451.20
20-Jan-23CornJan-2338.19
21-Jan-23CornJan-2338.69
22-Jan-23CornJan-2339.68
23-Jan-23CornJan-2340.18
20-Jan-23CornJan-2439.01
21-Jan-23CornJan-2439.23
22-Jan-23CornJan-2439.61
23-Jan-23CornJan-2440.42

 

 

Ritaf1983
Super User
Super User

Hi @bluebottle81 

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.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.