Forum Discussion
Need help with Power Bi calc
- 1 year ago
Thanks bhanu, i couldnt play with it much, when i used teh logic, i still couldnt get the calc correctly, i will work on it this week and will keep you posted.
- 1 year ago
Hi,
Based on the table that you have shared, show the expected result very clearly.
- 1 year ago
Hi,
PBI file attached.
Hope this helps.
Swathykorivi Try using
DAX
YoY Member Change % =
VAR SelectedSnapshotYear = SELECTEDVALUE('DPMLY Snapshots'[SnapshotYear])
VAR SelectedCohort = SELECTEDVALUE('DPMLY Snapshots'[Actdate])
-- Current year member count
VAR CurrentMcount =
CALCULATE(
MAX('DPMLY Snapshots'[Mcounts]),
FILTER(
'DPMLY Snapshots',
'DPMLY Snapshots'[SnapshotYear] = SelectedSnapshotYear &&
'DPMLY Snapshots'[Actdate] = SelectedCohort &&
'DPMLY Snapshots'[Snapshotdate] =
CALCULATE(
MAX('DPMLY Snapshots'[Snapshotdate]),
FILTER(
'DPMLY Snapshots',
'DPMLY Snapshots'[SnapshotYear] = SelectedSnapshotYear &&
'DPMLY Snapshots'[Actdate] = SelectedCohort
)
)
)
)
-- Previous year member count
VAR PrevMcount =
CALCULATE(
MAX('DPMLY Snapshots'[Mcounts]),
FILTER(
'DPMLY Snapshots',
'DPMLY Snapshots'[SnapshotYear] = SelectedSnapshotYear - 1 &&
'DPMLY Snapshots'[Actdate] = SelectedCohort &&
'DPMLY Snapshots'[Snapshotdate] =
CALCULATE(
MAX('DPMLY Snapshots'[Snapshotdate]),
FILTER(
'DPMLY Snapshots',
'DPMLY Snapshots'[SnapshotYear] = SelectedSnapshotYear - 1 &&
'DPMLY Snapshots'[Actdate] = SelectedCohort
)
)
)
)
RETURN
IF(
NOT ISBLANK(CurrentMcount) && NOT ISBLANK(PrevMcount),
DIVIDE(CurrentMcount - PrevMcount, PrevMcount, 0),
BLANK()
)
Thanks bhanu, i couldnt play with it much, when i used teh logic, i still couldnt get the calc correctly, i will work on it this week and will keep you posted.