# Tags
**Software** : [[Power Bi]] [[DAX]]
**Functions** used : [[Calculate]] [[Max]] [[AllSelected]] [[CalculateTable]] [[AddColumns]] [[Values]] [[AllExcept]] [[Filter]] [[CountRows]] [[If]] [[Isblank]] [[not]] [[EOMONTH]]
**Date** : 23-March-2025
# Description
- In this video, we delve deep into the world of Data Analysis Expressions (DAX) and explore how to effectively track and analyse lost customers. (Absolute Lost customers). Whether you're a business analyst, data enthusiast, or just someone looking to upskill, this video is packed with insights and practical tips! 🤓
# Video Link
<iframe width="560" height="315" src="https://www.youtube.com/embed/0sWOK5EAN5Y?si=Lo2otJLYAo1WX2gf" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
[GITHUB File Link](https://github.com/jbotes/powerbiTutorials/blob/main/28_Lost_Customers_NW_Video.pbix)
# DAX
```DAX
# Lost Customers (Absolute) =
VAR LastDateLost =
CALCULATE(
MAX('Date'[Date]),
ALLSELECTED('Date')
)
VAR CustomersWithLostDate =
CALCULATETABLE(
ADDCOLUMNS(
VALUES('Fact Sales'[CustomerID]),
"@LostCustomerDate", [Date Lost Customer (Absolute)]
),
ALLEXCEPT('Fact Sales', 'Customers'),
'Date'[Date] <= LastDateLost
)
VAR LostCustomers =
FILTER(
CustomersWithLostDate,
[@LostCustomerDate]
in VALUES ('Date'[Date])
)
VAR Result =
COUNTROWS(LostCustomers)
RETURN
Result
```
```DAX
Date Lost Customer (Absolute) =
VAR Maxdate =
CALCULATE(
MAX('Fact Sales'[OrderDate]),
ALLEXCEPT(
'Fact Sales',
'Fact Sales'[CustomerID],
'Customers'))
VAR Result =
IF(
NOT ISBLANK(Maxdate),
EOMONTH(Maxdate,3))
RETURN
Result
```
## Optional Tags
**Tags** :
**Technique** :