Forum Discussion

awitt's avatar
awitt
Helper III
6 years ago
Solved

Getting Totals From a Measure

This seems like it should be simple but I'm having issues with working with this measure.

 

I have two tables with a shared product key. One is an orders table with each row being an individual product purchased. The second table is cumulative forecast sales data with each row being a unique product. I have created a measure that simply calculates the difference between the forecasted number and the real sales number.  

 

What I am trying to do is work with this measure to find totals (324), calculate the total oversold (426: excluding the instances where the measure is negative) and the total undersold (102: excluding the instances where the measure is positive). 

 

Any ideas? Seems like it should be pretty straight forward but alas, here we are. 

 

 

 

 

  • YJ's avatar
    YJ
    6 years ago

    Hi awitt thanks for the detail desc

    For you:

    Because of the If condition, your measures didnt work. It takes a while to get used to and measures are almost always more efficient but in the meantime if you want to be sure you can start with cal columns.
    Anywei i provided the solution both as a measure(M) and cal column (cal)

    PBIX 

     

    regards

     

6 Replies

  • YJ's avatar
    YJ
    Resolver II

    Can you provide the pbix file with the source tables

    regards

      • YJ's avatar
        YJ
        Resolver II

        Hi awitt thanks for the detail desc

        For you:

        Because of the If condition, your measures didnt work. It takes a while to get used to and measures are almost always more efficient but in the meantime if you want to be sure you can start with cal columns.
        Anywei i provided the solution both as a measure(M) and cal column (cal)

        PBIX 

         

        regards

         

  • Icey's avatar
    Icey
    Community Support

    Hi awitt ,

     

    Is this problem sloved?


    If it is sloved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.


    If not, please let me know.


    Best Regards
    Icey

    • awitt's avatar
      awitt
      Helper III

      Not entirely - the calculated columns gave me a circular reference error. The measures did work. I'm really looking for what to write in the flase part of the HASONEFILTER command.

       

      I'll mark it as solved though for the measures. 

      • YJ's avatar
        YJ
        Resolver II

        Hi awitt , thanks for accepting e solution.  

        Can u go a screen capture of the error , I cannot see any of the error in the pbix file that was uploaded . 

        Regards