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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
paulohummel
Regular Visitor

table with 5 dates include a column that bring the percent difference between the last two dates

I have a table with the columns date,  metric and value.
i would like  to know if is possible to pivot the table and and add a column with the diffrerence about only the last two days

in power bi.

The pivot i found the chart that do it.

The problem is to add a column the brings the difference.

table 

date                           metric                 value

01.01.2024                 cash                      465464

01.01.2024                 amount                   45

02.01.2024                cash                     34654

02.01.2024                amount          45454

03.01.2024                 cash                      64564

03.01.2024               amount                 12

04.01.2024                cash                       64654

04.01.2024               amount                        54

 

chart cash

01.01.2024                02.01.2024                03.01.2024                    04.01.2024                %( between 03.01 aand 04.01

465464                       34654                            64564                            74654                  30

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @paulohummel ,

 

Here are the steps you can follow:

1. Create calculated table.

Test =
var _table=
SUMMARIZE('Table','Table'[date],"metric","difference",
"value",
SUMX(FILTER(ALL('Table'),'Table'[date]=MAXX(ALL('Table'),'Table'[date])),[value])
-
SUMX(FILTER(ALL('Table'),
'Table'[date]=MAXX(FILTER(ALL('Table'),'Table'[date]<MAXX(ALL('Table'),'Table'[date])),[date])
),[value]))
return
UNION(
    'Table',_table)

vyangliumsft_0-1715654522353.png

2. Result:

 

vyangliumsft_1-1715654522358.png

 

Best Regards,

Liu Yang

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

1 REPLY 1
Anonymous
Not applicable

Hi  @paulohummel ,

 

Here are the steps you can follow:

1. Create calculated table.

Test =
var _table=
SUMMARIZE('Table','Table'[date],"metric","difference",
"value",
SUMX(FILTER(ALL('Table'),'Table'[date]=MAXX(ALL('Table'),'Table'[date])),[value])
-
SUMX(FILTER(ALL('Table'),
'Table'[date]=MAXX(FILTER(ALL('Table'),'Table'[date]<MAXX(ALL('Table'),'Table'[date])),[date])
),[value]))
return
UNION(
    'Table',_table)

vyangliumsft_0-1715654522353.png

2. Result:

 

vyangliumsft_1-1715654522358.png

 

Best Regards,

Liu Yang

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.