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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Replicate Excel logic in DAX

Hi,

 

I would like to replicate in Power BI, preferabily using DAX, the below excel logic:

1) Combining all the rows of a week (Monday-Sunday). The process in excel currently is the following: the user is adding to the Monday's data the new records found on Tuesday, after this is comparing Monday+new Tuesday's data  with the Wednesdey's records and is adding to the Monday+new Tuesday's data the Wednesday's new records   and so one until Sunday (included).

This combined data is then compared with the next  Monday data and what is not found on Monday's records is marked as Outflow. This process is being repetead for all the following weeks and what I want to retrieve is the number of the records marked as Outflows during a certain week, by creating a first column like the one in the sample - Result - in a new DAX column.

 

Thank you,

Melissa

recordWeekWeekDayDateResult - in a new DAX column
12455421Sunday03/15/2020Outflow - is not appearing in the following Monday
12245442Monday03/16/2020 
12245442Tuesday03/17/2020 
12334432Tuesday03/17/2020Outflow - is not appearing in the following Monday
12245442Thurday03/19/2020 
12245472Sunday03/22/2020Outflow - is not appearing in the following Monday
12245443Monday03/23/2020 
12245443Wednesday03/25/2020Outflow - is not appearing in the following Monday
13345554Monday03/30/2020 

 

 

1 ACCEPTED SOLUTION
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

Column = 
VAR x = 
CALCULATE(
    MAX(Sheet1[record]),
    FILTER(
        Sheet1,
        Sheet1[Week] = EARLIER(Sheet1[Week]) + 1  && Sheet1[WeekDay] = "Monday"
    )
)
RETURN
IF(
    Sheet1[record] <> x && Sheet1[WeekDay] <> "Monday",
    "Outflow", BLANK()
)

jjj2.PNG

 

Best regards,
Lionel Chen

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

4 REPLIES 4
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

Column = 
VAR x = 
CALCULATE(
    MAX(Sheet1[record]),
    FILTER(
        Sheet1,
        Sheet1[Week] = EARLIER(Sheet1[Week]) + 1  && Sheet1[WeekDay] = "Monday"
    )
)
RETURN
IF(
    Sheet1[record] <> x && Sheet1[WeekDay] <> "Monday",
    "Outflow", BLANK()
)

jjj2.PNG

 

Best regards,
Lionel Chen

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

Greg_Deckler
Community Champion
Community Champion

I am not following this, I do not understand why some rows are marked as Outflow and others are not, like one Tuesday is and one is not and also the Thursday.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler 

 

Hi Greg,

 

Any idea how can I replicate this logic in DAX?

 

Many thanks,

Melisa

Anonymous
Not applicable

Hi @Greg_Deckler 

 

As you can see, that record is found in the next Monday, so it cannot be marked as Outflow.

 

Thank you,

Melisa

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors
Users online (12,545)