Forum Discussion

augustindelaf's avatar
augustindelaf
Icon for Impactful Individual rankImpactful Individual
7 years ago
Solved

Issue with Previous Month measure

Hello,

 

I have a table called Records_Africa. In this table, there is a measure called "Agility Score Conversion", that gets values that can be 1, 2, 3, 4 or nothing. When the user filters a date Slicer, "Agility Score Conversion" value is updated.

I successfully created a measure that gets the previous month of my Agility Score Conversion measure, but no result is displayed in Power BI (Blank value is displayed).

 

Here is the measure I created. Can you explain me why it doesn't display ?

Evol AGILITY SCORE CONV = CALCULATE([AGILITY SCORE Conv]; PREVIOUSMONTH(Records_Africa[Month]))
 
The value is "Blank". Why ?
I also tried to do it with a Date dimension but it did'nt change anything (visual is still Blank) : 
Evol AGILITY SCORE CONV = CALCULATE([AGILITY SCORE Conv]; PREVIOUSMONTH('time'[Date]))
 
Here is the file (Essec_Training_File_test) : 
 
Best regards,
Augustin

 

_

  • Hello v-lid-msft ,

     

    many thanks for your kind anwser.

    I opened your file to see how it works and to reproduce elements.

     

    In my file, I created the CALENDARAUTO function as you mentioned.

    In my file, I also used your function, (I already tried that one, Btw), like in your file.

     

    Still, it doesn't work, because M and M-1 measures are always the same.

     

    I reproduced exactly what you said

    In my source file, they should be different. (see image)

    Value for 05/2016 should be 3, and value for 06/2016 should be 4

     

    I uploaded my file in OneDrive, as you proposed.  There is no confidential data.

    https://1drv.ms/u/s!AkOv33tEaCSw1UEuNOB4Bvw_Q-AU?e=GJOxA1

     

    PS : my measure for current month already has, and must have a LASTDATE function, because it needs to get only last result, not a sum of results from previous months.

    Would you mind looking a bit at it, please?

     

    Thanks in advance,

    BR,

    Augustin

  • augustindelaf's avatar
    augustindelaf
    7 years ago

    For your information, I found my own solution. 

     

    LM AGILITY SCORE CONV = CALCULATE(SUM(Records_Africa[Agility Score Conversion]); PREVIOUSMONTH(('Month'[Month])))
     
    My Month Table was not correctly linked to facts Table.
    BR,
     
    Augustin

3 Replies

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

    Hi augustindelaf ,

     

    We suggest you to create a calendar table called DATE using CALENDARAUTO() function, then We can try to using the following DAX to get the value of previous month.

     

    Evol AGILITY SCORE CONV =
    CALCULATE (
        [AGILITY SCORE Conv],
        DATEADD ( 'DATE'[Date], -1, MONTH )
    )

     

    But because we do not have permission to download the test pbix file you shared, so if it does not meet your requirement, please kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

     

    BTW, pbix as attached.

     

    Community Support Team _ DongLi
    If this post helps, then please consider Accept it as the solution to help the other members find it more

    • augustindelaf's avatar
      augustindelaf
      Icon for Impactful Individual rankImpactful Individual

      Hello v-lid-msft ,

       

      many thanks for your kind anwser.

      I opened your file to see how it works and to reproduce elements.

       

      In my file, I created the CALENDARAUTO function as you mentioned.

      In my file, I also used your function, (I already tried that one, Btw), like in your file.

       

      Still, it doesn't work, because M and M-1 measures are always the same.

       

      I reproduced exactly what you said

      In my source file, they should be different. (see image)

      Value for 05/2016 should be 3, and value for 06/2016 should be 4

       

      I uploaded my file in OneDrive, as you proposed.  There is no confidential data.

      https://1drv.ms/u/s!AkOv33tEaCSw1UEuNOB4Bvw_Q-AU?e=GJOxA1

       

      PS : my measure for current month already has, and must have a LASTDATE function, because it needs to get only last result, not a sum of results from previous months.

      Would you mind looking a bit at it, please?

       

      Thanks in advance,

      BR,

      Augustin

      • augustindelaf's avatar
        augustindelaf
        Icon for Impactful Individual rankImpactful Individual

        For your information, I found my own solution. 

         

        LM AGILITY SCORE CONV = CALCULATE(SUM(Records_Africa[Agility Score Conversion]); PREVIOUSMONTH(('Month'[Month])))
         
        My Month Table was not correctly linked to facts Table.
        BR,
         
        Augustin