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
SirBI
Frequent Visitor

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
Super User
Super User

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 accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

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 accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Fowmy
Super User
Super User

@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


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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.

Top Solution Authors