Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
fred31330
Helper I
Helper I

Multiple combinations of duplicate columns

Hello,

 

I have a table like this:

 

CityFiscal PeriodUserValueCol5Col6
A01-17User1100......
A02-17User1120......
A01-17User1100......
B03-17User1200......
A02-17User3100......
B04-17User2300......

 

 And I would like to determine which rows are showing the following combinations:

  • same city, same period, same user, same value
  • same city, same period, different user, same value
  • same city, different period, same user, same value

 

Is it possible to achieve this with DAX, or shall I use the PowerQuery editor only?

Thanks!

Fred

1 ACCEPTED SOLUTION

The Group By will look for a grouping of all 4 fields.  So it's like if CIty A, Period1, User A, Value 1 then count +1.

 

If the user is different, then that would be a different group. 

 

Here is my inital mock up dataset. 

 

ss1.PNG

 

I did the group by like this:

ss2.PNG

 

The result dataset is like this:

 

ss3.PNG

View solution in original post

4 REPLIES 4
joshcomputer1
Helper V
Helper V

Just looking at what you are requesting...I would suggest to use the query editor. It seems like you want to "group by" city, same period, same user, same value. To do this, go to edit queries. Click Group By. Advanced. Include the different groupings in the top section. The bottom section is probably just a count rows of those groupings (if you have a sum or other aggregate, try that instead of count rows). 

I appreciate your swift response!

But how can I identify cases such as "same city, different period, same user, same value"?

 

Say I have the following scenario:

 

city A, period 1, user B, value C

city A, period 1, user B, value C

city A, period 2, user B, value C

 

At the end, I would like to have this in my resulting table:

 

city A, period 1, user B, value C, count 2

city A, period 2, user B, value C, count 1

 

I understand I'd have to group by city, user and value, but how can I ensure I won't have cases with the same period appearing more than once?

Thanks.

 

The Group By will look for a grouping of all 4 fields.  So it's like if CIty A, Period1, User A, Value 1 then count +1.

 

If the user is different, then that would be a different group. 

 

Here is my inital mock up dataset. 

 

ss1.PNG

 

I did the group by like this:

ss2.PNG

 

The result dataset is like this:

 

ss3.PNG

Thank you!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.