Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Wrong Totals

Hi guys,

 

I am trying to create my own forecast because it is based on a planning.

To do this I have a few measures and some data to go with it.

 

Measure to determine the price of the hours in a certain month:
Planning = sumx('Forecast'; 'Forecast'[Hours] * 'Forecast'[PriceFC])

Measure to calculate the cumulative total of the worked hours
CumulativeTotal = CALCULATE(Sum(TimeTransactions[AmountFC]);FILTER(ALL(PowerBI_Calendar[Date]); PowerBI_Calendar[Date] <= Max(PowerBI_Calendar[Date])))

Measure to determine if I need to use the actual worked hours or the planning:
GuideLine = IF(OR(SUMX(TimeTransactions; TimeTransactions[AmountFC]) = BLANK(); SUMX(TimeTransactions; TimeTransactions[AmountFC]) < [Planning]); [Planning]; SUM(TimeTransactions[AmountFC]))

Measure to get the cumulative total of my guideline so it can be shown nicely in a graph:
Cumulative Forecast = CALCULATE([GuideLine];FILTER(ALL(PowerBI_Calendar[Datum]); PowerBI_Calendar[Datum] <= Max(PowerBI_Calendar[Datum])))

The problem lies with the Cumulative forcast, it should be a different number than it is showing.
Does anyone know what I am doing wrong?

 

Sample data 

 

 

4 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Greg_Deckler ,

       

      I have been trying your solution, but I am not sure how to continue.

      I made this measure:

       

      MyMeasure2 =
      VAR __table = SUMMARIZE(TimeTransactions;[Project];"__value"; [GuideLine])
      Return
      IF(HASONEVALUE(TimeTransactions[Project]); [GuideLine];SUMX(__table; [__value]))
       
      But it gives me even weirder values
       
       
      Can you help me?
       
      Best regards,
      Queenie

       

      • Greg_Deckler's avatar
        Greg_Deckler
        Icon for Community Champion rankCommunity Champion

        Try this:

         

        MyMeasure2 =
        VAR __table = SUMMARIZE(TimeTransactions;[Maand];"__value"; [GuideLine])
        Return
        IF(HASONEVALUE(TimeTransactions[Project]); [GuideLine];SUMX(__table; [__value]))

         

        You should summarize by whatever you are summarizing by in your table visualization (it looks like "Maand"). The value (__value) should be the measure you want to aggregate correctly in the total line. 

         

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

    Hi Anonymous 

     

    So what's in table 'TimeTransactions'?Can you show me your .pbix file?

     

    Best Regards,
    Kelly
    Did I answer your question? Mark my post as a solution!