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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Project portfolio - project for next month and due this month

Hi, 

 

I need to create a project portfolio, which need to count the amount of project that due next month and due this month. 

Also another measure of project amount started next month. 

 

How should I do that? 

I have calendar table. 

And the data table shown below 

Row numberStartEnd Project Name
14/12/2022

5/6/2023

xxx

25/10/2022

11/11/2022

yyy

38/9/2022

12/12/2022

zzz

 

Thanks for your help

3 ACCEPTED SOLUTIONS

You can put the Date[End] column into the slicer and replace all the ALL to VALUES in the code, like this:

 

ProjectDueThisMonth :=
COUNTROWS(
    FILTER(
        VALUES(Data),
        MONTH(Data[End]) = MONTH(TODAY())
    )
)
ProjectDueNextMonth :=
COUNTROWS(
    FILTER(
       VALUES(Data),
        MONTH(Data[End]) = MONTH(TODAY())+1
            &&YEAR(Data[End])=YEAR(TODAY())
        )
    )
ProjectStartNextMonth =
COUNTROWS(
    FILTER(
       VALUES(Data),
        MONTH(Data[Start]) = MONTH(TODAY())+1
            &&YEAR(Data[Start])=YEAR(TODAY())
        )
    )

 

p.s. ALL ignores all filter context (e.g. from slicer selection), while VALUES takes filter context into evaluation. 

View solution in original post

Anonymous
Not applicable

Hi @FreemanZ,

 

I'm using the measure below, but it stll not function. Do you know where I can change?

ProjectDueThisMonth _3 =
calculate(COUNTROWS(
    FILTER(
        VALUES(Data),
        MONTH(Data[End ]) = MONTH(TODAY())
    )
   
),
 USERELATIONSHIP('Calendar'[Date],Data[End ]))
 
 
Thanks for your help. 

View solution in original post

If the active relationship is now on End column and in case you need to refer to the Start column, you would need to add a line with USERELATIONSHIP, like this:
 
ProjectStartNextMonth =
CALCULATE(    
    COUNTROWS(
        FILTER(
           VALUES(Data),
           MONTH(Data[Start]) = MONTH(TODAY())+1
            &&YEAR(Data[Start]) = YEAR(TODAY())
        )
     ),
    USERELATIONSHIP(Data[Start], 'Date'[Date])
)

View solution in original post

10 REPLIES 10
FreemanZ
Super User
Super User

Supposing your table named Data, try to create the measures with the code below:
 
ProjectDueThisMonth := 
COUNTROWS( 
    FILTER(
        Data,
        MONTH(Data[End]) = MONTH(TODAY())
    )
)
 
ProjectDueNextMonth := 
COUNTROWS( 
    FILTER(
        Data,
        MONTH(Data[End]) = MONTH(TODAY())+1
            &&YEAR(MONTH(Data[End]))=YEAR(TODAY())
        )
    )
 
ProjectStartNextMonth =
COUNTROWS( 
    FILTER(
        Data,
        MONTH(Data[Start]) = MONTH(TODAY())+1
            &&YEAR(MONTH(Data[Start]))=YEAR(TODAY())
        )
    )
Anonymous
Not applicable

Hi @FreemanZ,

Is this code able to use with the date filter? 

Because I try to input those measure, it show blank eventhough there should be count by 1. 

 

I use date slicer select the month November 2022, it suppose show me 1 end next month, 1 start next month and 1 end this month. but at the end it shown blank for me. 

 

Thanks for your help. 

You can put the Date[End] column into the slicer and replace all the ALL to VALUES in the code, like this:

 

ProjectDueThisMonth :=
COUNTROWS(
    FILTER(
        VALUES(Data),
        MONTH(Data[End]) = MONTH(TODAY())
    )
)
ProjectDueNextMonth :=
COUNTROWS(
    FILTER(
       VALUES(Data),
        MONTH(Data[End]) = MONTH(TODAY())+1
            &&YEAR(Data[End])=YEAR(TODAY())
        )
    )
ProjectStartNextMonth =
COUNTROWS(
    FILTER(
       VALUES(Data),
        MONTH(Data[Start]) = MONTH(TODAY())+1
            &&YEAR(Data[Start])=YEAR(TODAY())
        )
    )

 

p.s. ALL ignores all filter context (e.g. from slicer selection), while VALUES takes filter context into evaluation. 

Anonymous
Not applicable

Hi @FreemanZ , 

The new measure is work but just referring to current November 2022. I wondering if I can pick the month like December 2022 or others. 

I wondering is it be okay to use the own calendar table? By clicking June 2023, it should show 1 in the result. 

Anno_0-1668602771242.png

Thanks for your help. 

 

Yes, you can. But you need to build the relationship with the referred column, the End column or Start column. As you have two date columns, that would be a bit tricky and you may find USERELATIONSHIP function useful. Enjoy. 

Anonymous
Not applicable

Hi @FreemanZ,

 

I'm using the measure below, but it stll not function. Do you know where I can change?

ProjectDueThisMonth _3 =
calculate(COUNTROWS(
    FILTER(
        VALUES(Data),
        MONTH(Data[End ]) = MONTH(TODAY())
    )
   
),
 USERELATIONSHIP('Calendar'[Date],Data[End ]))
 
 
Thanks for your help. 
Anonymous
Not applicable

Hi @FreemanZ

How should I use USERELATIONSHIP this function? I have buile the relationship in the model. 

Anno_0-1668605926306.png

 

Thanks for your help. 

 

 

If the active relationship is now on End column and in case you need to refer to the Start column, you would need to add a line with USERELATIONSHIP, like this:
 
ProjectStartNextMonth =
CALCULATE(    
    COUNTROWS(
        FILTER(
           VALUES(Data),
           MONTH(Data[Start]) = MONTH(TODAY())+1
            &&YEAR(Data[Start]) = YEAR(TODAY())
        )
     ),
    USERELATIONSHIP(Data[Start], 'Date'[Date])
)
Anonymous
Not applicable

Hi @FreemanZ , 

After applying the measure, only the duethis month is functioning, hwever other two not working. 

Do you know why it will happen?

Anno_0-1668608236549.png

Thanks for your help. 

 

The code is checked and should be OK now:

 

ProjectDueThisMonth :=
COUNTROWS(
    FILTER(
        ALL(Data),
        MONTH(Data[End]) = MONTH(TODAY())
    )
)
ProjectDueNextMonth :=
COUNTROWS(
    FILTER(
        ALL(Data),
        MONTH(Data[End]) = MONTH(TODAY())+1
            &&YEAR(Data[End])=YEAR(TODAY())
        )
    )
ProjectStartNextMonth =
COUNTROWS(
    FILTER(
        ALL(Data),
        MONTH(Data[Start]) = MONTH(TODAY())+1
            &&YEAR(Data[Start])=YEAR(TODAY())
        )
    )

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.