Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Measure to calculate Order Number

Hello,

 

I am looking for a measure that would calculate the amount of orders that are assigned to Operations and the amount of orders assigned to Maintenance.

 

Thanks!

 

  • Hey Anonymous ,

     

        There a few ways you can go about this depending on how you want to show your data

     

        I've gone ahead and used your sample data

     

     

     

    One option is create a measure for each category

     

    Operations Measure =
    
    CALCULATE(COUNT(Test[Job]), Test[Responsible] = "Operations")
    
    Maintenance Measure = 
    
    CALCULATE(COUNT(Test[Job]), Test[Responsible] = "Maintenance")

     

    Those two measures will give you this

     

     

    Alternatively you can just create a general measure like this if you are going to put this into a table

     

    Job Count =
    
    CALCULATE(COUNT(Test[Job]))

     

     

     

    If for some reason you need to show them both as text inside of a card visual

     

    Combined Text Measure = 
    
    var TheOperationsMeasure = CALCULATE(COUNT(Test[Job]), Test[Responsible] = "Operations")
    
    var TheMaintenanceMeasure = CALCULATE(COUNT(Test[Job]), Test[Responsible] = "Maintenance")
    
    return
    
    "Operations: " & TheOperationsMeasure
    & UNICHAR(10) &
    "Maintenance: " & TheMaintenanceMeasure

     

     

     

    Let us know if these meet your need!

2 Replies

  • Hey Anonymous ,

     

        There a few ways you can go about this depending on how you want to show your data

     

        I've gone ahead and used your sample data

     

     

     

    One option is create a measure for each category

     

    Operations Measure =
    
    CALCULATE(COUNT(Test[Job]), Test[Responsible] = "Operations")
    
    Maintenance Measure = 
    
    CALCULATE(COUNT(Test[Job]), Test[Responsible] = "Maintenance")

     

    Those two measures will give you this

     

     

    Alternatively you can just create a general measure like this if you are going to put this into a table

     

    Job Count =
    
    CALCULATE(COUNT(Test[Job]))

     

     

     

    If for some reason you need to show them both as text inside of a card visual

     

    Combined Text Measure = 
    
    var TheOperationsMeasure = CALCULATE(COUNT(Test[Job]), Test[Responsible] = "Operations")
    
    var TheMaintenanceMeasure = CALCULATE(COUNT(Test[Job]), Test[Responsible] = "Maintenance")
    
    return
    
    "Operations: " & TheOperationsMeasure
    & UNICHAR(10) &
    "Maintenance: " & TheMaintenanceMeasure

     

     

     

    Let us know if these meet your need!

  • Hi,

    Create a Table visual and drag Responsible there.  Write this measure and drag it to the visual.

    Count = countrows(Data)

    Data is the name of the Table that you shared.

    Hope this helps.