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
benjellounm
Regular Visitor

filter by group by

Hi Everyone, I need help creating a group by the table and use it to filter my data. The table has two columns; the name of the firm and Certification type and what I would like to do is create a table or column (whatever works) that shows whenever a firm is both DBE and SBE the result should show "SBE-DBE".

 

 

 Table

Firm name |  Certification

Firm A        |  SBE

Firm B        |  DBE

Firm A       |  DBE

 

I would like the result to be something like this

Firm name |  Certification

Firm A        |  SBE-DBE

Firm B        |  DBE

 

Thank you in advance 🙂

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Picture1.png

 

New Table =
ADDCOLUMNS (
VALUES ( Data[Firm] ),
"@Certification",
CALCULATE(
IF (
{ "SBE" }
IN VALUES ( Data[Certification] )
&& { "DBE" } IN VALUES ( Data[Certification] ),
"SBE-DBE",
DISTINCT ( Data[Certification] )
)
)
)
 
 
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

Picture1.png

 

New Table V2 =
ADDCOLUMNS (
SUMMARIZE(Data,Data[Firm],Data[Status]),
"@Certification",
CALCULATE(
IF (
{ "SBE" }
IN VALUES ( Data[Certification] )
&& { "DBE" } IN VALUES ( Data[Certification] ),
"SBE-DBE",
DISTINCT ( Data[Certification] )
)
)
)
 
 
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

6 REPLIES 6
Jihwan_Kim
Super User
Super User

Picture1.png

 

New Table =
ADDCOLUMNS (
VALUES ( Data[Firm] ),
"@Certification",
CALCULATE(
IF (
{ "SBE" }
IN VALUES ( Data[Certification] )
&& { "DBE" } IN VALUES ( Data[Certification] ),
"SBE-DBE",
DISTINCT ( Data[Certification] )
)
)
)
 
 
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


one more question is it possible to add a third if statement with the third column?

I would like to have something like this if the firm is DBE and ESB and Active then ESB-DBE 

Example

Firm name |  Certification  |  Status

Firm A        |  SBE               |   Active 

Firm B        |  DBE               |  Denied

Firm A       |  DBE                | Active

 

Result 


Firm name |  Certification  |  Status

Firm A        |  SBE-DBE       |  Active

Firm B        |  DBE               | Denied

Picture1.png

 

New Table V2 =
ADDCOLUMNS (
SUMMARIZE(Data,Data[Firm],Data[Status]),
"@Certification",
CALCULATE(
IF (
{ "SBE" }
IN VALUES ( Data[Certification] )
&& { "DBE" } IN VALUES ( Data[Certification] ),
"SBE-DBE",
DISTINCT ( Data[Certification] )
)
)
)
 
 
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Thank you very much 😊

AllisonKennedy
Super User
Super User

@benjellounm 

Do you have a Dim table for Firm already? 

 

Once you get that Firm table, relate it to the certifications table. Then you can add a column to it using DAX:

List of Certifications = CONCATENATEX(RELATEDTABLE(Certifications), Certifications[Certification], "-")
 
See sample file below signature.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Fowmy
Super User
Super User

@benjellounm 

Create the following table. This will summarize by Firm not only SBE-DBE but whatever multiple rows per firm.
Let me know if this works for you.

New Table = 
VAR __TABLE = 
    SUMMARIZE(
        TABLE8,
        Table8[Firm name],
        "CERTIFICATION",
        CONCATENATEX(
            DISTINCT( Table8[Certification] ),
            Table8[Certification], " - "
        )
    )
RETURN
    __TABLE

Fowmy_0-1626589914418.png

 





Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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.