cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

## Dax - find an item in last month's data

I've got data that gets produced on the first of the month and i need to  create a boolean column based on if a particular id in this month was also in the data from last month.

how do i go about that?

3 ACCEPTED SOLUTIONS
Solution Sage

Assuming you have a Table1 with all the historical and latest data in there, and column name is ID.

COUNTIF for Duplicate IDs =
VAR __ID = Table1[ID]
RETURN
COUNTROWS(
FILTER(
ALL(Table1),
__ID = Table1[ID]
)
)

Hope this is what you are looking for.

ended up using this in the end as i needed the id and extra criteria:

var ID = 'table'[id]
var prevMonth = STARTOFMONTH( previousmonth( 'table'[reporting_date]) )
var result = LOOKUPVALUE( 'table'[extraCriteria],
'table'[id], ID,
'table'[reporting_date], prevMonth
)
return result

Community Support

Glad your problem is solved, can you accept the correct answer as solution, so that other users with similar problems to yours can find the solution faster, thanks in advance!

Hope it helps,

Community Support Team _ Caitlyn

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

3 REPLIES 3
Community Support

Glad your problem is solved, can you accept the correct answer as solution, so that other users with similar problems to yours can find the solution faster, thanks in advance!

Hope it helps,

Community Support Team _ Caitlyn

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

ended up using this in the end as i needed the id and extra criteria:

var ID = 'table'[id]
var prevMonth = STARTOFMONTH( previousmonth( 'table'[reporting_date]) )
var result = LOOKUPVALUE( 'table'[extraCriteria],
'table'[id], ID,
'table'[reporting_date], prevMonth
)
return result

Solution Sage

Assuming you have a Table1 with all the historical and latest data in there, and column name is ID.

COUNTIF for Duplicate IDs =
VAR __ID = Table1[ID]
RETURN
COUNTROWS(
FILTER(
ALL(Table1),
__ID = Table1[ID]
)
)

Hope this is what you are looking for.