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
henryvu93
Helper I
Helper I

DAX formula for referencing previous cells in the row

Hi guys,

 

I created a matrix (screenshot below is a sample):

PivotTable.PNG

Basically "1" & "0" here are for determining the status of the customer: If customer bought something in a month, I marked them as Active ("1"). For this purpose, I used the function:

if([MonthlyPrice]  > 0 , 1, 0)

 

Now, I want to create a new measure: if they are "Active" over the last 3 months (current month, previous month & the month before previous month), I mark them as "Returning" customers. I would like the table to calculate this new status every month for e.g. if we are looking at Dec 2015, the status be based on Oct-15, Nov-15 & Dec-15 and so on. However, I don't know if we can reference the cutomer's "Active" status for previous months. I just wonder if we can use DAX to do something like that?

 

Any help/insight will be really appreciated! Thank you!

 

Henry

1 ACCEPTED SOLUTION
henryvu93
Helper I
Helper I

I think I found the solution for this: I created a date column based on [Month] & [Year]; then I calculate the moving sum of "Active" status over the last 3 months for each row using the DATESINPERIOD() function. The matrix was just an end result. Thank you for very useful discussion on:

 

https://community.powerbi.com/t5/Desktop/Moving-Average/m-p/43041#M16519

 

 

View solution in original post

1 REPLY 1
henryvu93
Helper I
Helper I

I think I found the solution for this: I created a date column based on [Month] & [Year]; then I calculate the moving sum of "Active" status over the last 3 months for each row using the DATESINPERIOD() function. The matrix was just an end result. Thank you for very useful discussion on:

 

https://community.powerbi.com/t5/Desktop/Moving-Average/m-p/43041#M16519

 

 

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

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.