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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
ephramz
Helper II
Helper II

How to count the number of times a unique value appear in two columns

How do i include a calculated column/ calculated field in the data model such that it calculates the number of times (for example in Op No. column ,the value '9999' and in Equipment column, the value '215320307' appears, for this case which should show as '3'). Show in the picture below.

And from there I want to get the highest time value between CN47N Actual Time column and IW49 Actual Time column and sum them up for rows that '9999' in Op No column and '215320307' in Equipment column appear and divide by the count '3' that was calculated from the calculated column/ calculated field earlier.

 

unnamed.png

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @ephramz ,

Try dax like this :

Count =
CALCULATE (
    COUNT ( 'ENGG VM_TRM'[OP.No.] ),
    FILTER (
        'ENGG VM_TRM',
        'ENGG VM_TRM'[Equipment] = EARLIER ( 'ENGG VM_TRM'[Equipment] )
            && 'ENGG VM_TRM'[OP.No.] = EARLIER ( 'ENGG VM_TRM'[OP.No.] )
    )
)

See the below ,a sample:

vluwangmsft_0-1630655064162.png

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

View solution in original post

1 REPLY 1
v-luwang-msft
Community Support
Community Support

Hi @ephramz ,

Try dax like this :

Count =
CALCULATE (
    COUNT ( 'ENGG VM_TRM'[OP.No.] ),
    FILTER (
        'ENGG VM_TRM',
        'ENGG VM_TRM'[Equipment] = EARLIER ( 'ENGG VM_TRM'[Equipment] )
            && 'ENGG VM_TRM'[OP.No.] = EARLIER ( 'ENGG VM_TRM'[OP.No.] )
    )
)

See the below ,a sample:

vluwangmsft_0-1630655064162.png

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.