Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
77 | |
74 | |
49 |
User | Count |
---|---|
146 | |
108 | |
106 | |
90 | |
62 |