Forum Discussion
PBIX_COACH
Helper II
3 years agoCustomer Count by Active Years
Hello Team I need some assistance getting a DAX formula to work for this. I have two tables (Customers sales table and Calendar table) connected by the date field and I would like to get a count of t...
- 3 years ago
Hi PBIX_COACH
You can use the matrix total column to present the Total Active Years (You can simply rename it). You need to replace the current measure (Measure1) with the followingMeasure2 = IF ( ISINSCOPE ( 'Date'[Year] ), [Measure1], COUNTX ( VALUES ( 'Date'[Year] ), [Measure1] ) )
PBIX_COACH
Helper II
3 years agotamerj1 on another note how can I flag if there was a "win back" for example company A had a gap year in 2021 but returned in 2022?
tamerj1
Community Champion
3 years agoPBIX_COACH
Please try
Measure2 =
IF (
ISINSCOPE ( 'Date'[Year] ),
[Measure1],
VAR T1 =
ADDCOLUMNS ( VALUES ( 'Date'[Year] ), "@Value", [Measure1] )
VAR T2 =
FILTER ( T1, [@Value] <> BLANK () )
RETURN
"Total Active Years: " & COUNTROWS ( T2 )
& UNICHAR ( 10 ) & "Win Back Years: "
& SUMX ( T2, INT ( ISEMPTY ( FILTER ( T2, [Year] = EARLIER ( [Year] ) - 1 ) ) ) )
)