Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Datesinperiod returning blank values

Morning - I hope someone can help.

 

The below DAX is returning no values but this wasn't happening until earlier this morning and as far as I am aware no changes to the undelrying model.  Note this is performing as a (required) calculated column and not a measure.

 

Core_Costs_Forecast =
CALCULATE(
SUM('5-5Finance'[Forecast Core (T1)]),
'5-5Finance'[Finance Category]
IN { "5215102907 - Security Core", "5215100000 - LLM Core", "5215100006 - FM Core" }, datesinperiod('5-5Finance'[period], today(),-12,month))
 
It works fine and returns a value to each row if I remove the 'datesinperiod' part of the statement but that is necessary for me to only sum over the selected period.
 
Does any helpful person have any suggestions as to what might be going awry here please?
 
Thanks
 
Ian

2 Replies

  • selimovd's avatar
    selimovd
    Icon for Most Valuable Professional rankMost Valuable Professional

    Hey Anonymous ,

     

    I think you have to debug in small pieces.

    Maybe try first to see if it's calculating the correct sum if you just use a few days:

    Core_Costs_Forecast =
    CALCULATE(
        SUM( '5-5Finance'[Forecast Core (T1)] ),
        DATESINPERIOD( '5-5Finance'[period], TODAY(), -3, DAY )
    )

     

    If that works try to use a slicer and slice it down to the categories "5215102907 - Security Core", "5215100000 - LLM Core" and "5215100006 - FM Core".

     

    If that works try it for 12 months. At one point you will realize where the error is.

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could give it a thumbs up 👍!

    Best regards
    Denis

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Based on my test, the calculated column worked. Please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.