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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi everyone,
i like to count the total number of accounts whose lastinvoicedatefirstdate for each of the rows.
for example if i select selected period to be 12 months, then if the current row is 2023 january, i want it to count the total number of acounts found in 2022 january.
context
the idea is that if i am looking at 2023 january. then if an account whose last transaction with us is more than the selected period. which means that they have no activity at all from the last period to now, then we have deemed the account as a lost account.
i have this code but it keeps showing a blank in the table visual.
@learningOh , Try like
test3 =
var currentdates = LASTDATE('FACT'[key(calendarfirstdate)])
var lastpdate = Date(Year(currentdates),month(currentdates)-1*[Selected Period] ,day(currentdates))
return
CALCULATE(DISTINCTCOUNT('FACT'[account num]),FILTER('FACT',
'FACT'[lastinvoicedatefirstdate]= lastpdate))
also refer
Latest
https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!