Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Count items that reach a value threshold

Hi, following my previous discussion here, I need to calculate a measure, that gives a number of products that reach a certain threshold.

 

For example I have 2 tables

 

Table1: Sales_current_mnth 

Product nameQTYValue
A510
B1010
A12
C515
A12
C1030
A2550
B1010

 

Additionally, I have an aggregated list of sales from previous months:

 

Table 2: Name: Sales_before_mnth

Product nameQTYValue
A100200
B5050
C3090


We can caclulate the Total value as 

Total Sales = SUM ( Sales_before_mnth[Value] ) + SUM ( Sales_current_mnth[Value] )
 
How can I construct a measure that shows, That e.g. Product A has reached a planned threshold of 250?

 

  • FreemanZ's avatar
    FreemanZ
    3 years ago

    aha, then you need a dimtable and a measure with this:

    PlanCheck =
    VAR TtlValue =
    SUMX(CurrentMonth, CurrentMonth[Value])
    +
    SUMX('PreviousMonth', 'PreviousMonth'[Value])
    RETURN IF(TtlValue>=250, "Plan exceeded", "Plan OK")
     
    model:

     

    try to plot a Table Visual with the measure and the Product Column from the dimtable. I tried and it worked like this:

     


     

     

6 Replies

  • the result of a measure depends on its context. how would you present the threshold check measure?

    • Anonymous's avatar
      Anonymous
      Not applicable

      HI, I need to calculate a SUM of Value per product, add a value from previous month. The calculate value has to be compared with a threshold. 

       

      For example:

       

      For product A

       

      Sum of Value (current mnth) = 10 + 2 + 2 + 50 = 64

      Total value = 64 + 200 = 264

      264 > 250 >>> measure returns a string "Plan exceeded"

       

       

      • FreemanZ's avatar
        FreemanZ
        Super User

        aha, then you need a dimtable and a measure with this:

        PlanCheck =
        VAR TtlValue =
        SUMX(CurrentMonth, CurrentMonth[Value])
        +
        SUMX('PreviousMonth', 'PreviousMonth'[Value])
        RETURN IF(TtlValue>=250, "Plan exceeded", "Plan OK")
         
        model:

         

        try to plot a Table Visual with the measure and the Product Column from the dimtable. I tried and it worked like this: