Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Radek_Z
Advocate I
Advocate I

How to get Current AND Previous month's project status in one table

There are so many questions and answers posted on this topic, yet none of them seem exactly like this, and none of them work for me:

I have to report on monthly project statuses, but I also want to show how each project's status has changed over the past few months.

 

Each month I append the month's project status submissions from our team to an ever-growing Excel list. Here is a simplified view of the data. The Reporting Month data is actually a full date (2021-Jan is showing up as 2021-01-01), but I have it showing just as YYYY-MMM to keep it clean.

 

Project Name | Reporting Month | Status
Project 12021-JanGreen
Project 22021-JanGreen
Project 32021-JanGreen
Project 12021-FebYellow
Project 22021-FebGreen
Project 32021-FebGreen
Project 12021-MarRed
Project 22021-MarYellow
Project 32021-MarGreen

 

Assuming that we are in the March 2021 reporting period, I would like to generate a table that shows the project Status for this month, last month, and 2 months ago, like this:

 

Project Name | This Month's Status | Last Month's Status | 2 Months ago Status
Project 1RedYellowGreen
Project 2YellowGreenGreen
Project 3GreenGreenGreen

 

I have a complete Date table linked to the Reporting Month column and it works as expected in my other visuals. I tried using variations of the PREVIOUSMONTH formula but always unsuccessful. I believe the solution lies with a DAX measure; I just can't figure it out.

 

I would also like the table to only show Projects where the Status has changed in the past 2 months. How do I go about removing rows where there are no Status changes? In the example above, I don't want to see Project 3 on the table since it's Green for all 3 months. 

 

Any ideas? Thanks in advance!

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @Radek_Z 

you can use matrix, then create a measure like bellow

Measure = 
var _count=CALCULATE(DISTINCTCOUNT('Table'[Status]),ALLEXCEPT('Table','Table'[Project Name]))
return _count

result:

vxiaotang_0-1625651510498.gif

 

 

Best Regards,

Community Support Team _ Tang

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

View solution in original post

5 REPLIES 5
v-xiaotang
Community Support
Community Support

Hi @Radek_Z 

you can use matrix, then create a measure like bellow

Measure = 
var _count=CALCULATE(DISTINCTCOUNT('Table'[Status]),ALLEXCEPT('Table','Table'[Project Name]))
return _count

result:

vxiaotang_0-1625651510498.gif

 

 

Best Regards,

Community Support Team _ Tang

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

v-xiaotang
Community Support
Community Support

Hi @Radek_Z 

vxiaotang_1-1625126654212.png

 

 

Best Regards,

Community Support Team _ Tang

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

Thank you for catching my mistake! I have corrected my original post to reflect what I meant to have originally written.


Radek

amitchandak
Super User
Super User

@Radek_Z , PREVIOUSMONTH will work if you have date and date table. I see only month sample. So if you can create date and use date table you should be able to get status

 

Last month = CALCULATE(Max(Table[Status]),previousmonth('Date'[Date]))

 

last to last month = CALCULATE(Max(Table[Status]),previousmonth(dateadd('Date'[Date],-1,MONTH)))

 

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Hi Amit,

 

Thank you for the quick reply.

 

I have tried your proposal but some of the results (depending on Month selection in slicer) do not make any sense. Here is a sample dataset to illustrate the situation, while using the two measures that you suggested. In this case, I am showing just one project over 6 months of Status reporting, where the Status goes from Green to Yellow in the 3rd month of reporting:

 

Project NameReporting MonthStatus
Project 12020-Dec

Green

Project 12021-JanGreen
Project 12021-FebYellow
Project 12021-MarYellow
Project 12021-AprYellow
Project 12021-MayYellow

 

Here is the resulting table when I select the Reporting Month from my Slicer to 2021-May or 2021-Apr:

Project NameCurrent StatusLast Month Status2 Months ago Status
Project 1YellowYellowYellow

So far, so good.

 

But when I select 2021-Mar from the Slicer, here are the results:

Project NameCurrent StatusLast Month Status2 Months ago Status
Project 1Green Green
Project 1YellowYellow 

As you can see, there are a number of things wrong here:

1) Project 1 is reported twice instead of being combined across date range

2) Blanks now in some Statuses, in both rows

3) Combination of Yellow and Green for the same project, completely non-sensical result.

 

When I select 2021-Feb, the result looks correct:

Project NameCurrent StatusLast Month Status2 Months ago Status
Project 1GreenGreenGreen

 

When I select 2021-Jan, the results are also correct (I am expecting a blank in the 2 Months ago Status as this lies outside the date range and no data exists for that month):

Project NameCurrent StatusLast Month Status2 Months ago Status
Project 1GreenGreen 

 

Finally, when I select 2020-Dec, the results are again incorrect (nothing shows up at all, but I am expecting the Current Status to be Green, and blanks for Last Month and 2 Months ago):

Project NameCurrent StatusLast Month Status2 Months ago Status
    

 

Do you have any idea what is happening here? Thank you!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.