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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
AndreeaV
Advocate I
Advocate I

Yield curve in PowerBI

Hi,

 

I would like to create a Treasury yield curve in PowerBI like the one on the left in this app I found online. https://app.powerbi.com/view?r=eyJrIjoiZDc1ZGFhYzItZWIyYy00N2UyLTg0YzgtMGViYWEyYzZhMDQ3IiwidCI6IjRhY...

 

Data looks like this: https://home.treasury.gov/resource-center/data-chart-center/interest-rates/TextView?type=daily_treas...

 

I would like to know how to make the curve for one day, so I do the same for the rest. I tried to create measures, but I got error messages saying that I couldn't display more than one value in a measure. If I create a table for each date I want, I can't create the chart. Plus, creating tables is not dynamic.

 

Thanks!

 
1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @AndreeaV ,

 

If you want to create line charts as the app in the link, I think you need to transform your underlying data by UNPIVOT function.

Select [Date] column and use UNPIVOT other columns. New table should look like as below.

RicoZhou_0-1678437725855.png

Measure:

Most Recent = 
VAR _Recent_Date = CALCULATE(MAX('Table'[Date]),ALL('Table'))
RETURN
CALCULATE(SUM('Table'[Value]),'Table'[Date] = _Recent_Date)
Week Ago = 
VAR _Recent_Date = CALCULATE(MAX('Table'[Date]),ALL('Table'))
return
CALCULATE(SUM('Table'[Value]),'Table'[Date] = _Recent_Date - 7)
Month Ago = 
VAR _Recent_Date = CALCULATE(MAX('Table'[Date]),ALL('Table'))
return
CALCULATE(SUM('Table'[Value]),'Table'[Date] = _Recent_Date - DAY(EOMONTH(_Recent_Date,-1)))

...

Result is as below.

RicoZhou_1-1678439203660.png

 

Best Regards,
Rico Zhou

 

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

2 REPLIES 2
AndreeaV
Advocate I
Advocate I

Thanks @v-rzhou-msft !

v-rzhou-msft
Community Support
Community Support

Hi @AndreeaV ,

 

If you want to create line charts as the app in the link, I think you need to transform your underlying data by UNPIVOT function.

Select [Date] column and use UNPIVOT other columns. New table should look like as below.

RicoZhou_0-1678437725855.png

Measure:

Most Recent = 
VAR _Recent_Date = CALCULATE(MAX('Table'[Date]),ALL('Table'))
RETURN
CALCULATE(SUM('Table'[Value]),'Table'[Date] = _Recent_Date)
Week Ago = 
VAR _Recent_Date = CALCULATE(MAX('Table'[Date]),ALL('Table'))
return
CALCULATE(SUM('Table'[Value]),'Table'[Date] = _Recent_Date - 7)
Month Ago = 
VAR _Recent_Date = CALCULATE(MAX('Table'[Date]),ALL('Table'))
return
CALCULATE(SUM('Table'[Value]),'Table'[Date] = _Recent_Date - DAY(EOMONTH(_Recent_Date,-1)))

...

Result is as below.

RicoZhou_1-1678439203660.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.