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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Creating table with calculated values from another table

Hi!

Is it possible to create a table from another table where you calculate the change of variable. In my table I have many  variables for road condition. The same road is measured many times and i'd like to create a table where I can see how the values have changed between runs. In the picture the blue table is the state my data is now and the green is the desired outcome. Thanks in advance!

 

 

 

 

                                   .PicturePicture

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

Yes, it's possible although a little unusual to go down to individual value differences since power bi is generally good for aggregations and visualising sequences.

You could create a calculated column similar to this:

DiffPreviousYr = VAR _year = road[run]
VAR _road = road[rd]
VAR _dist = road[dist]
VAR _previousVal = CALCULATE(SUM(road[val1]), FILTER(road, road[dist] = _dist && road[rd] = _road && road[run] = _year - 1))
RETURN
 road[val1] - _previousVal

and, for your visualisation (which includes road, distance and year , and the calculated column) you would need to use slicers or filters on each of those columns so, for example, year = 2019, run = 1, distance = 100

View solution in original post

2 REPLIES 2
HotChilli
Super User
Super User

Yes, it's possible although a little unusual to go down to individual value differences since power bi is generally good for aggregations and visualising sequences.

You could create a calculated column similar to this:

DiffPreviousYr = VAR _year = road[run]
VAR _road = road[rd]
VAR _dist = road[dist]
VAR _previousVal = CALCULATE(SUM(road[val1]), FILTER(road, road[dist] = _dist && road[rd] = _road && road[run] = _year - 1))
RETURN
 road[val1] - _previousVal

and, for your visualisation (which includes road, distance and year , and the calculated column) you would need to use slicers or filters on each of those columns so, for example, year = 2019, run = 1, distance = 100

Anonymous
Not applicable

Thank you @HotChilli , this was really helpful!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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