Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
hi @Sofia_A ,
Not sure if i fully get you. Supposing you have a data table like:
you may try:
1) create a dates table like:
dates = ADDCOLUMNS( CALENDARAUTO(), "Year", YEAR([date]) )
2) relate the dates[date] with data[date] with 1:M relationship.
3) try to plot at table visual with dates[Year] column and a measure like:
AmtPY =
VAR _lastrecordday =
MAXX(
FILTER(
ALL(data),
data[date]<MIN(dates[date])
),
data[Date]
)
VAR _result =
SUMX(
FILTER(
ALL(data),
YEAR(data[date]) = YEAR(_lastrecordday)
),
data[Amt]
)
RETURN COALESCE(_result, 0)
it worked like:
hi @Sofia_A ,
Not sure if i fully get you. Supposing you have a data table like:
you may try:
1) create a dates table like:
dates = ADDCOLUMNS( CALENDARAUTO(), "Year", YEAR([date]) )
2) relate the dates[date] with data[date] with 1:M relationship.
3) try to plot at table visual with dates[Year] column and a measure like:
AmtPY =
VAR _lastrecordday =
MAXX(
FILTER(
ALL(data),
data[date]<MIN(dates[date])
),
data[Date]
)
VAR _result =
SUMX(
FILTER(
ALL(data),
YEAR(data[date]) = YEAR(_lastrecordday)
),
data[Amt]
)
RETURN COALESCE(_result, 0)
it worked like:
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
12 | |
11 | |
7 | |
6 |