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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Add column to shown Previous Day value for each row

Hi... I probably tried everything but nothing is working out. Below is my data and I am trying to add two columns.

 

1. One column to show the previous day's Used Megabytes for each row.

 

2. Another column to show the percentage change between previous Used Megabytes and Current Date's Used Megabytes.

 

Computer NameDiskAllocated GBTotal MegabytesUsed MegabytesReported Date
Server AC:7475868.1666709.4201/05/2019 23:00
Server AC:7475868.1666711.8602/05/2019 23:00
Server AC:74.275868.1666720.9803/05/2019 23:00
Server AC:73.275878.466740.7104/05/2019 23:00
Server AC:7475868.1666728.6305/05/2019 23:00
Server AC:7475857.9266733.406/05/2019 23:00
Server AC:8075878.466755.8407/05/2019 23:00
Server BC:7475868.1626687.3101/05/2019 23:00
Server BC:7475868.1626687.3102/05/2019 23:00
Server BC:7375878.426687.3103/05/2019 23:00
Server BC:7875868.1626687.3104/05/2019 23:00
Server BC:7475868.1636690.2705/05/2019 23:00
Server BC:7475868.1640703.0706/05/2019 23:00
Server BC:9075868.1616626.9607/05/2019 23:00

 

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

Please see the below.

 

previous day's Used Megabytes = 
VAR rd = Table1[Reported Date]
VAR cn = Table1[Computer Name]
VAR ld = CALCULATE(
    MAX(Table1[Reported Date]),
    Table1,
    Table1[Computer Name] = cn,
    Table1[Reported Date] < rd
)
RETURN 
CALCULATE(
    MAX(Table1[Used Megabytes]),
    Table1,
    Table1[Computer Name] = cn,
    Table1[Reported Date] = ld
)
% change = DIVIDE(Table1[Previous], Table1[Used Megabytes]) -1 

Regards,
Mariusz

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
ChandeepChhabra
Impactful Individual
Impactful Individual

Will the previous day be as per the Computer Name?

If yes then please download my solution using Power Query

 

Capture.PNG

Hope this helps

thanks

Mariusz
Community Champion
Community Champion

Hi @Anonymous 

Please see the below.

 

previous day's Used Megabytes = 
VAR rd = Table1[Reported Date]
VAR cn = Table1[Computer Name]
VAR ld = CALCULATE(
    MAX(Table1[Reported Date]),
    Table1,
    Table1[Computer Name] = cn,
    Table1[Reported Date] < rd
)
RETURN 
CALCULATE(
    MAX(Table1[Used Megabytes]),
    Table1,
    Table1[Computer Name] = cn,
    Table1[Reported Date] = ld
)
% change = DIVIDE(Table1[Previous], Table1[Used Megabytes]) -1 

Regards,
Mariusz

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

Anonymous
Not applicable

OH MY GOD...! I have been struggling for this since the past 7 hours. Now words to say. Thanks a lot 🙂

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.