cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SirBI
New Member

Compare Weekday to Previous Weekday (Monday to last Monday, Tuesday to last Tuesday, etc.)

 rundate   checktypeid    state    value    DOW
  6/11/21    1             ALL      250     Friday
  6/10/21    1             ALL      240     Thursday
  6/10/21    2             FL       300     Thursday
  6/10/21    2             FL       310     Thursday
  6/4/21     1             ALL      400     Friday
  6/3/21     2             FL       410     Friday

I want to display in my table the previous weekday value. (For example, see below table)

 

  rundate    Last_DOW_value
  6/11/21       400
  6/10/21       
  6/10/21       410
  6/4/21          
  6/3/21      

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Community Champion
Community Champion

Hi, @SirBI 

Please check the below picture and the sample pbix file's link down below.

It is for creating measures.

 

Picture1.png

 

Current Week Value Measure =
SUM ( 'Table'[value] )
 
Previous Week Value Measure =
CALCULATE (
[Current Week Value Measure],
FILTER (
ALL ( 'Table' ),
'Table'[rundate]
= MAX ( 'Table'[rundate] ) - 7
&& 'Table'[checktypeid] = MAX ( 'Table'[checktypeid] )
&& 'Table'[state] = MAX ( 'Table'[state] )
)
)
 
 
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

Best regards, JiHwan Kim

Linkedin: https://www.linkedin.com/in/jihwankim1975/

Twitter: https://twitter.com/Jihwan_JHKIM

View solution in original post

2 REPLIES 2
Jihwan_Kim
Community Champion
Community Champion

Hi, @SirBI 

Please check the below picture and the sample pbix file's link down below.

It is for creating measures.

 

Picture1.png

 

Current Week Value Measure =
SUM ( 'Table'[value] )
 
Previous Week Value Measure =
CALCULATE (
[Current Week Value Measure],
FILTER (
ALL ( 'Table' ),
'Table'[rundate]
= MAX ( 'Table'[rundate] ) - 7
&& 'Table'[checktypeid] = MAX ( 'Table'[checktypeid] )
&& 'Table'[state] = MAX ( 'Table'[state] )
)
)
 
 
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

Best regards, JiHwan Kim

Linkedin: https://www.linkedin.com/in/jihwankim1975/

Twitter: https://twitter.com/Jihwan_JHKIM

View solution in original post

Fowmy
Super User IV
Super User IV

@SirBI 

If you have a Dates Table then you can create this measure :

Previous Week Value =
CALCULATE ( SUM ( TABLE[Value] ), DATEADD ( dates[date], -7, DAY ) )

 otherwise,



Previous Week Value =
VAR __previousweekdate =
    SELECTEDVALUE ( Table[Date] ) - 7
VAR __previousweekvalue =
    CALCULATE ( SUM ( TABLE[Value] ), table[Date] = __previousweekdate )
RETURN
    __previousweekvalue

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Blog - Data Visualization

Website   YouTube    LinkedIn   PBI User Group

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors
Top Kudoed Authors