Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Calculating Available time for a Period and Production Line

Hi community!!

I have a table named “Table1”:

I need something (a measure, I think) that allows me to calculate the “Available_TIME” as the sum of the Available_minutes.

This Available_TIME should consider the period I select (for example 1st and 2nd April), and only be affected by the filtering by production line (field Line).

For the period selected (1st and 2nd April), my Available_TIME should be:

If I filtered (with a slicer, for example) by Category = Preventive, I should get:

If I filtered by Line = Line1, I should get:

If I change the period selected (for example, 2nd April) should be:

 

I hope I am clear. Can anyone help me with this issue?

Thanks a lot!

 

  • Hi Anonymous 

    You can create a Measure as the following.

     

    Detail =
    
    VAR val =
    
        ALLSELECTED ( Table1[Date] )
    
    RETURN
    
        IF (
    
            ISERROR ( val ),
    
            CALCULATE (
    
                SUM ( Table1[Available_minutes] ),
    
                ALLEXCEPT ( Table1, Table1[Line] )
    
            ),
    
            CALCULATE (
    
                SUM ( Table1[Available_minutes] ),
    
                ALLEXCEPT ( Table1, Table1[Line], Table1[Date] )
    
            )
    
        )

     

    The result looks like this:

     

     

    For more details, you can refer the attached pbix file.

     

    Best Regards

    Caiyun Zheng

     

    Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

2 Replies

  • This pseudo code should get you what you need

     

    CALCULATE(SUM('Table'[Available Minutes]),ALLEXCEPT('table'[Line]))

  • v-cazheng-msft's avatar
    v-cazheng-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous 

    You can create a Measure as the following.

     

    Detail =
    
    VAR val =
    
        ALLSELECTED ( Table1[Date] )
    
    RETURN
    
        IF (
    
            ISERROR ( val ),
    
            CALCULATE (
    
                SUM ( Table1[Available_minutes] ),
    
                ALLEXCEPT ( Table1, Table1[Line] )
    
            ),
    
            CALCULATE (
    
                SUM ( Table1[Available_minutes] ),
    
                ALLEXCEPT ( Table1, Table1[Line], Table1[Date] )
    
            )
    
        )

     

    The result looks like this:

     

     

    For more details, you can refer the attached pbix file.

     

    Best Regards

    Caiyun Zheng

     

    Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.