Forum Discussion

IghorFerreira's avatar
IghorFerreira
New Member
1 year ago
Solved

Count Rows From 2 Different Fact Tables Based in Date

Hello, everyone! It's my first post here, sorry if there's anything wrong in the request.   I need to count the total amount of preventive work orders executed by machine and date in one table, but...
  • gmsamborn's avatar
    1 year ago

    Hi IghorFerreira 

     

    Would the following measures help?

     

    Scheduled = 
        CALCULATE(
            COUNTROWS( 'Schedule' ),
            'Schedule'[Data] IN VALUES( 'Date'[Date] )
        )
    
    
    Completed = 
        CALCULATE(
            DISTINCTCOUNT( 'WorkOrders'[Machine] ),
            'WorkOrders'[Date] IN VALUES( 'Schedule'[Data] )
        )
    
    
    Compliance % = 
        DIVIDE( 
            [Completed], 
            [Scheduled] 
        )

     

     

    Let me know if you have any questions.