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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Sashavg14
Helper I
Helper I

DAX Formula

I want to create a measure/column that can filter if the following: 

Timeliness_600 =
CALCULATE(
    COUNTROWS(TBL_WORK_ORDER),
    TBL_WORK_ORDER[PRIMARY_TRADE] = "600",
    TBL_WORK_ORDER[CRITICAL_STATUS_CODE] IN {"A", "B", "C", "D", "00", "01", "04"}
)
is registrered with a date in COMPLETED_DATE from my TBL_HISTORY tabel. I want to show the count that does not have a COMPLETED_DATE in TBL_History, so I only track "active" work orders. WORK_ORDER_NUMBERS is what is used to identify the work order between the tables. How can I achieve this?

Thank you!
1 ACCEPTED SOLUTION
v-jiewu-msft
Community Support
Community Support

Hi @Sashavg14 ,

Based on the description, please try the following methods:

1.Create the sample table.

vjiewumsft_0-1731316135547.png

2.Create the new column to filter the order.

Filter Work Order = 
IF(
    TBL_WORK_ORDER[PRIMARY_TRADE] = 600 &&
    TBL_WORK_ORDER[CRITICAL_STATUS_CODE] IN {"A", "B", "C", "D", "00", "01", "04"} &&
    ISBLANK(RELATED('Table history'[COMPLETED_DATE])),
    1, 
    0
)

3.Create the new measure to calculate the count.

Count not completed date = 
CALCULATE(
    COUNTROWS(TBL_WORK_ORDER), TBL_WORK_ORDER[Filter Work Order] = 1)

4.The result is shown below.

vjiewumsft_1-1731316149649.png

 

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-jiewu-msft
Community Support
Community Support

Hi @Sashavg14 ,

Based on the description, please try the following methods:

1.Create the sample table.

vjiewumsft_0-1731316135547.png

2.Create the new column to filter the order.

Filter Work Order = 
IF(
    TBL_WORK_ORDER[PRIMARY_TRADE] = 600 &&
    TBL_WORK_ORDER[CRITICAL_STATUS_CODE] IN {"A", "B", "C", "D", "00", "01", "04"} &&
    ISBLANK(RELATED('Table history'[COMPLETED_DATE])),
    1, 
    0
)

3.Create the new measure to calculate the count.

Count not completed date = 
CALCULATE(
    COUNTROWS(TBL_WORK_ORDER), TBL_WORK_ORDER[Filter Work Order] = 1)

4.The result is shown below.

vjiewumsft_1-1731316149649.png

 

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ankur04
Resolver II
Resolver II

Hi @Sashavg14 ,

 

It will be really helpfull for community members to understand more about your requirement if you can share your table structure along with the modeling tab snap shot.

 

Sometimes a problem can be solved with simple approach if it is explained well.

 

please share some sample data and relationship details.

 

Thanks,

 

aduguid
Super User
Super User

Try this one

 

Timeliness_600_Active =
CALCULATE(
    COUNTROWS(TBL_WORK_ORDER),
    TBL_WORK_ORDER[PRIMARY_TRADE] = "600",
    TBL_WORK_ORDER[CRITICAL_STATUS_CODE] IN {"A", "B", "C", "D", "00", "01", "04"},
    NOT(
        TBL_WORK_ORDER[WORK_ORDER_NUMBERS] 
        IN 
        SELECTCOLUMNS(
            FILTER(
                TBL_HISTORY, 
                NOT(ISBLANK(TBL_HISTORY[COMPLETED_DATE]))
            ),
            "WORK_ORDER_NUMBERS", TBL_HISTORY[WORK_ORDER_NUMBERS]
        )
    )
)
SachinNandanwar
Impactful Individual
Impactful Individual

Please post some sample data and expected output.



Regards,
Sachin
Check out my Blog

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.