Forum Discussion

Piu's avatar
Piu
Regular Visitor
1 year ago
Solved

Not getting categories present in previous month but not in present month

I was trying to calculate the productivity of previous month but I m not getting all the categories which are present in previous month but not in current month.

the 2 measures which I have used to calculate it is mentioned below

Total_Productivity =
IF (
    [New_Dwg] <> 0,
    DIVIDE([Total MH], [New_Dwg])
)
_prev_Productivity = If ([New_Dwg] <> 0,
 Calculate([Total_Productivity],PREVIOUSMONTH('Date'[Date])))
Please help me how to solve this problem
  • That is something you usually do via EXCEPT.

     

    Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
    Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
    Please show the expected outcome based on the sample data you provided.

    Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
    Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Piu ,

    Thank you for reaching out to the Microsoft Fabric Community.

     

    To calculate the categories that are present in the previous month but not in the current month, you can use DAX to compare the data from both months. You can use the EXCEPT function to identify categories that exist in the previous month but are missing in the current month. Ensure that your PREVIOUSMONTH function is correctly applied to your measures and that the conditions in your IF statements are set appropriately for accurate calculation.

     

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

     

    Thankyou.

5 Replies

  • That is something you usually do via EXCEPT.

     

    Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
    Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
    Please show the expected outcome based on the sample data you provided.

    Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
    Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Piu ,

    Thank you for reaching out to the Microsoft Fabric Community.

     

    To calculate the categories that are present in the previous month but not in the current month, you can use DAX to compare the data from both months. You can use the EXCEPT function to identify categories that exist in the previous month but are missing in the current month. Ensure that your PREVIOUSMONTH function is correctly applied to your measures and that the conditions in your IF statements are set appropriately for accurate calculation.

     

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

     

    Thankyou.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Piu  ,

      I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.


      Thank you.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi @Piu  ,

    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.


    Thank you.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Piu ,

     

    May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

     

    Thank you.