Forum Discussion

hanyfouda2023's avatar
hanyfouda2023
Helper II
2 years ago
Solved

Days Vending machine non operating

Hi helpers, I have list of vending machines & database is contains Master tables for serial numbers & Sales tables contains "Sales , Qty"  I'm facing an issue that if one vending machine doesnt  wor...
  • Daniel29195's avatar
    Daniel29195
    2 years ago

     

    please follow these steps : 

     step 1 

    create datetable table : 

    datetable = CALENDAR(MIN(transactions[Date ]), MAX(transactions[Date ]))





    sample data used : 

     

     
    step 2 : 
    link datetable new the transaction table via date column. 

     

     

    step3 : create this measure : 

     

     

    non working days =
    var dates = ALL(datetable[Date])

    var available_dates =
    CALCULATETABLE(
        VALUES(transactions[Date ]),
        ALLSELECTED(datetable[Date])
    )

    var result =
    EXCEPT(
        dates,
        available_dates
    )

    return  

    CALCULATE(
        COUNTROWS(datetable),
        KEEPFILTERS(result)
    )
    step 4 :  create the visual 

     

    drag the following columns the visual .

     

     

    final result : 
    this will gives the non working hours per #serial .

     

     

     

    hope this helps .

     

    best regards