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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
habibsyed01
Regular Visitor

Accessing Previous records!

Hello Everyone!

 

Scenario

Here is my situation. I have a table/view that records every transaction. In Power BI I have aggregated the table to show summary for each day for last 8 days. I have a requirement to compute the growth in total consultations by comparing the total consultation for a specific date for example Sep 7, 2018 to the total consultation on the date which was 1 week before the specific date i.e., Aug 31, 2018

The growth is calculated by the formula:
(Total consultations for current date - Total consultations for Last weeks date)/(Total consultation for last weekdate)

 

Problem

I can access the current total consultations as it is the current record. But having a hard time trying to access the last week consultations. 

 

What I am looking for is something to let me access the records based on a date condition.

Something that would 

1. take current record date - 7 days,

2. use this date as a filter to apply on whole table,

3, get the records that match this date

4. and sum the total consultation for this records.

 

Now number 2  and 3 are the issue that I am unable to solve. I would apprecitate if anyone can point me in the right direction.

1 REPLY 1
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@habibsyed01,

I make a test using the sample table below. And create the following columns.

Index = RANKX(FILTER(Table3,Table3[Date]<EARLIER(Table3[Date])),Table3[Date],,ASC,Dense)
last 7 days value = CALCULATE(SUM(Table3[Value]),FILTER(Table3,Table3[Index]=EARLIER(Table3[Index])-7))

1.PNG

If the above DAX don't help, please share sample data of your table that can be copied and pasted here. Also post expected result in the forum.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.