I don’t know how you got these numbers based on your request of looking into past, but if that is what you want here is the solution.
831Cust =
CALCULATE (
DISTINCTCOUNT ( 'Table'[customerId] ),
KEEPFILTERS ( '831 Customers'[Group Flag] = "831Cust" )
)
.
Non 831 Cust =
CALCULATE (
DISTINCTCOUNT ( 'Table'[customerId] ),
KEEPFILTERS ( '831 Customers'[Group Flag] <> "831Cust" )
)
.
Ratio over Non 831 =
DIVIDE (
[831Cust],
[Non 831 Cust]
)
You need to work on your data model, those Store, Customer, and id are not readable at all, replace them with integers so that it is easier to verify the results. I can’t tell which customer to check for. And why keep those 11 blank columns?
I have used the below date table to show result based on date from dates table.
Dates =
VAR MinDate = YEAR ( MIN ( 'Table'[created] ) )
VAR MaxDate = YEAR ( MAX ( 'Table'[created] ) )
VAR CalendarStartDate = DATE ( MinDate, 1, 1 )
VAR CalendarEndDate = DATE ( MaxDate, 12, 31 )
VAR DateList = CALENDAR ( CalendarStartDate, CalendarEndDate )
VAR Result =
GENERATE (
DateList,
VAR CurrentDate = [Date]
RETURN
ROW (
"MonthNumber", MONTH ( CurrentDate ),
"Month Name", FORMAT ( CurrentDate, "MMMM" ),
"Year", YEAR ( CurrentDate ),
"Year Month", FORMAT ( CurrentDate, "YYYY MM" ),
"Quarter", FORMAT ( CurrentDate, "\QQ" )
)
)
RETURN
Result
EDNA PBIX File (1).pbix (1.7 MB)