Forum Discussion

jeff212312's avatar
jeff212312
Regular Visitor
4 years ago
Solved

Custom calculations per time period

Dear Experts,

 

I have a question. I need to recreate a table which has some custom time calculations in it. For example every month till the current date is ACTUAL data. And from there on it needs to evaluate if there is a value in ACTUAL and when not retrieve forecast data. I am struggeling to get this to work, my first approach was to use a custom column but the FORECAST and ACTUAL data are on differents rows so it is hard to evaluate if there was a previous value via a custom column.


My approach now is to use a SWITCH TRUE and write in the measure the specific calculation per Period. Is this the right approach?

 

 

many thanks in advance

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi jeff212312,

    According to your description and snapshot, it seems like a basic aggregation calculation based on two group fields.
    For this scenario, you did not need to use the switch function to hade code and split each calculation. You can directly get the aggregated result based on current category groups in calculate function:

    formula =
    CALCULATE (
        SUM ( ProjectData[ProjectID] ),
        ALLSELECTED ( ProjectData ),
        VALUES ( ProjectData[Periode] ),
        VALUES (ProjectData[Evdescription])
    )

    Regards,

    Xiaoxin Sheng

3 Replies

  • jeff212312's avatar
    jeff212312
    Regular Visitor

     

    Hi  Amitchandak,

    Many thanks for you taking time to look into my issue. I get the above error message. I want to evaluate the formulas as specificed at the VAR for every row based on the time as shown in the column. 

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi jeff212312,

      According to your description and snapshot, it seems like a basic aggregation calculation based on two group fields.
      For this scenario, you did not need to use the switch function to hade code and split each calculation. You can directly get the aggregated result based on current category groups in calculate function:

      formula =
      CALCULATE (
          SUM ( ProjectData[ProjectID] ),
          ALLSELECTED ( ProjectData ),
          VALUES ( ProjectData[Periode] ),
          VALUES (ProjectData[Evdescription])
      )

      Regards,

      Xiaoxin Sheng