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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Faracla
Frequent Visitor

Adding a new column for a Matrix Table

Dear all,

This is my first post here, hope to get a solution for my what I'm facing 🙂

 

I have a matrix table and I'm trying to achieve a specific result to be showed, adding a new column
Basically, customer want to see if in a specific month, a forwarder that was awarder within a lane did not carry any shipment , not even one.

Awarded is already filtered to show only awarded,  column Accepted shows if there where instances where something was accepted or rejected (0 not accepted, 1 is accepted)
I want to add a column that says something like:

"If carrier was awarded and they did at least one shipment , even though in the same month they did not accepted something then is OK, else NotOK" and then I can filter out what I don't need.

In the example attached, if we take into account july 2021, we see that we have in accepted column one line for 0 and one line for 1, means that forwarder did at least one shipment so needs to be excluded

I've tried for an entire day to find a solution but I could not get where I want
I'm attaching a screenshot of my current matrix to help

 

Thanks in advance

Claudio

 

2022-09-21_0-33-09.jpg

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Faracla,

You can try to use the following dax formulas to show the result based on conditions:

Measure version:

formula =
VAR rCount =
    CALCULATE (
        COUNTROWS ( Table ),
        FILTER ( ALLSELECTED ( Table ), [AwardedYN] = 1 && [Accepted YN] = 1 ),
        VALUES ( Table[LaneCode] ),
        VALUES ( Table[MonthYear] )
    )
RETURN
    IF ( rCount > 0, "OK", "NotOk" )

Calculate column version:

formula =
VAR rCount =
    CALCULATE (
        COUNTROWS ( Table ),
        FILTER (
            Table,
            Table[LaneCode] = EARLIER ( Table[LaneCode] )
                && Table[LaneCode] = EARLIER ( Table[MonthYear] )
                && Table[AwardedYN] = 1
                && Table[Accepted YN] = 1
        )
    )
RETURN
    IF ( rCount > 0, "OK", "NotOk" )

Regards,

Xiaoxin Sheng

View solution in original post

3 REPLIES 3
Faracla
Frequent Visitor

Hi @Anonymous 
there was a bug in the code ,I substitute and it worked perfectly! 
here the one it worked

formula =
VAR rCount =
    CALCULATE (
        COUNTROWS ( Table ),
        FILTER (
            Table,
            Table[LaneCode] = EARLIER ( Table[LaneCode] )
                && Table[MonthYear] = EARLIER ( Table[MonthYear] )
                && Table[AwardedYN] = 1
                && Table[Accepted YN] = 1
        )
    )
RETURN
    IF ( rCount > 0, "OK", "NotOk" )



thank you very much for your help 😄 

Faracla
Frequent Visitor

Hi @Anonymous ,
first of all, thanks for your answer , i tried your suggestions but unfortunately id did not work as expected, please see screen attached:

As you can see, the final result is "Not OK" for all of them, while the expected result should be that for carrier "TEST 1" result should be "OK" because in the month of august, even if they have some 0 in colum "AcceptedYN", they also have 1 , means they still did carry some shipments, therefore are to be excluded.
Carrier "TEST" is correct because in the month of august all value in colum "AcceptedYN" is 0 and this is what will be flagged to customer.

Attaching a new screenshot of expected result, columns in read are the result of your suggestions, column in Yellow is the expected result


2022-09-21_9-41-10.jpg

Anonymous
Not applicable

Hi @Faracla,

You can try to use the following dax formulas to show the result based on conditions:

Measure version:

formula =
VAR rCount =
    CALCULATE (
        COUNTROWS ( Table ),
        FILTER ( ALLSELECTED ( Table ), [AwardedYN] = 1 && [Accepted YN] = 1 ),
        VALUES ( Table[LaneCode] ),
        VALUES ( Table[MonthYear] )
    )
RETURN
    IF ( rCount > 0, "OK", "NotOk" )

Calculate column version:

formula =
VAR rCount =
    CALCULATE (
        COUNTROWS ( Table ),
        FILTER (
            Table,
            Table[LaneCode] = EARLIER ( Table[LaneCode] )
                && Table[LaneCode] = EARLIER ( Table[MonthYear] )
                && Table[AwardedYN] = 1
                && Table[Accepted YN] = 1
        )
    )
RETURN
    IF ( rCount > 0, "OK", "NotOk" )

Regards,

Xiaoxin Sheng

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.

Top Solution Authors
Top Kudoed Authors