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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Salauat
Regular Visitor

New column calculated by grouping

Hello gents,

I have a table, which contains few columns, which I use to drill through visualizations.

I want to create a new calculated column, which will be looking into "A1" and "Status".

Can you help me to write DAX expression for new column? 

 

Calculated logic as follows:

  • If Status is "Good" for all same A1 groups, then the Expected result "Good"
  • If at least one row in Status shows "Not Good" in one A1 grouping, then the expected result would be "Not Good"
A1StatusExpected result
1GoodNot Good
1Not GoodNot Good
1GoodNot Good
2GoodGood
2GoodGood
3Not GoodNot Good
3GoodNot Good
4Not GoodNot Good
3 REPLIES 3
CNENFRNL
Community Champion
Community Champion

Flag =
IF(
    ISEMPTY(
        FILTER( INFO, INFO[A1] = EARLIER( INFO[A1] ) && INFO[Status] <> "Good" )
    ),
    "Good",
    "Not Good"
)

Screenshot 2021-08-08 173016.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Jihwan_Kim
Super User
Super User

Picture1.png

 

Expected result CC : =
VAR _currentAone = 'Table'[A1]
VAR _filtertable =
FILTER ( 'Table', 'Table'[A1] = _currentAone )
VAR _selectstatuscolumn =
SELECTCOLUMNS ( _filtertable, "@status", 'Table'[Status] )
RETURN
SWITCH (
TRUE (),
"Not Good" IN _selectstatuscolumn, "Not Good",
NOT ( "Not Good" IN _selectstatuscolumn ), "Good"
)
 
 
 

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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Jos_Woolley
Solution Sage
Solution Sage

Hi,

 

NewColumn =
REPT (
    "Not ",
    CALCULATE (
        COUNTROWS ( 'Table' ),
        'Table'[Status] = "Not Good",
        'Table'[A1] = EARLIER ( 'Table'[A1] )
    ) > 0
) & "Good"

 

Regards

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.