Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
This is a sample data table. My requirement is to calculate:
How may People who are from Marketing in 2018 were part of 2017 Sales? Answer is : 4 (C,D,E & F)
I am not sure if this has a simple trick to calculate in dax but I am not able to answer .
| Name | Year | Program |
| A | 2017 | Sales |
| B | 2017 | Sales |
| C | 2017 | Sales |
| D | 2017 | Sales |
| E | 2017 | Sales |
| F | 2017 | Sales |
| G | 2017 | Sales |
| A | 2017 | Marketing |
| B | 2017 | Marketing |
| C | 2017 | Marketing |
| H | 2018 | Sales |
| I | 2018 | Sales |
| J | 2018 | Sales |
| K | 2018 | Sales |
| L | 2018 | Sales |
| C | 2018 | Marketing |
| D | 2018 | Marketing |
| E | 2018 | Marketing |
| F | 2018 | Marketing |
Solved! Go to Solution.
@Sabarikumar7579,
if you are looking to count the number of rows, create a measure like this:
Count of Name =
VAR t1 = NATURALINNERJOIN (
SELECTCOLUMNS (
FILTER ( Table1, Table1[Year] = 2018 && Table1[Program] = "Marketing" ),
"Name", [Name]
),
SELECTCOLUMNS (
FILTER ( Table1, Table1[Year] = 2017 && Table1[Program] = "Sales" ),
"Name", [Name]
)
)
RETURN COUNTROWS(t1)Otherwise, if you are looking for a list, use this instead:
List of Name =
VAR t1 = NATURALINNERJOIN (
SELECTCOLUMNS (
FILTER ( Table1, Table1[Year] = 2018 && Table1[Program] = "Marketing" ),
"Name", [Name]
),
SELECTCOLUMNS (
FILTER ( Table1, Table1[Year] = 2017 && Table1[Program] = "Sales" ),
"Name", [Name]
)
)
RETURN CONCATENATEX(t1, [Name], ", ")
Hi,
You may download my PBI file from here.
Hope this helps.
Hi,
You may download my PBI file from here.
Hope this helps.
You are welcome.
@Sabarikumar7579,
if you are looking to count the number of rows, create a measure like this:
Count of Name =
VAR t1 = NATURALINNERJOIN (
SELECTCOLUMNS (
FILTER ( Table1, Table1[Year] = 2018 && Table1[Program] = "Marketing" ),
"Name", [Name]
),
SELECTCOLUMNS (
FILTER ( Table1, Table1[Year] = 2017 && Table1[Program] = "Sales" ),
"Name", [Name]
)
)
RETURN COUNTROWS(t1)Otherwise, if you are looking for a list, use this instead:
List of Name =
VAR t1 = NATURALINNERJOIN (
SELECTCOLUMNS (
FILTER ( Table1, Table1[Year] = 2018 && Table1[Program] = "Marketing" ),
"Name", [Name]
),
SELECTCOLUMNS (
FILTER ( Table1, Table1[Year] = 2017 && Table1[Program] = "Sales" ),
"Name", [Name]
)
)
RETURN CONCATENATEX(t1, [Name], ", ")
Hmm, that's some pretty ugly data. I think to do this correctly, you would need something to determine the last status of 2017.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!