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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
sunny27
Frequent Visitor

Count by End of Month--Reposting

 

https://community.powerbi.com/t5/Desktop/Count-by-End-of-Month-Reposting/m-p/507546#M237114

 

Please go through the above link

 

For example for Student Number 30830 the Effective date for Status Change is on same day but there is other field i didn't mention in sample data is UpdatedDate.

 

StudentGUIDStudentNumberStudentStatusIDStatusEffectiveDateUpdatedDate
8136E11E-0A6A-4AB9-B7EE-315B72A27280308302Pending8/2/20188/2/2018
F102367E-B10F-4D68-B1B9-AFA78550A8EF308303Approved8/2/20188/30/2018

 

If the status is changed in same month it should show the updated Status in that month.

 

Capture.PNG

 

 For Pending below is the code, but we are getting above result in Pending and Approved.Please let me know if you have any questions and help me out on this.

 Pending2 = 
VAR __minDate =
MIN ( 'Date'[Date] )
VAR __maxDate =
MAX ( 'Date'[Date] )
VAR __tmpTable =
SUMMARIZE (
tblStudent,
tblStudent[StudentGUID],
tblStudent[StudentNumber],
tblStudent[StudentStatusID],
"__UpdatedDate", MAX ( [UpdatedDate] )
)
VAR __tmpTable1 =
ADDCOLUMNS (
__tmpTable,
"__Status", MAXX (
FILTER (
tblStudent,
tblStudent[StudentGUID],
= EARLIER ( [StudentGUID],)
&& [__UpdatedDate] = EARLIER ( [__UpdatedDate] )
),
[StudentStatusID]
)
)
RETURN
COUNTROWS (
FILTER (
__tmpTable,
[__UpdatedDate] >= __minDate
&& [__UpdatedDate] <= __maxDate
&& tblStudent[StudentStatusID]=2 )
)

Please help me out on this

1 REPLY 1
v-lili6-msft
Community Support
Community Support

hi,sunny27

    I have tested your formula, there are a few extra commas in it. It works well, StudentNumber 30830 has one Pending

in Aug-2018.

Please share some data sample and the expected output.

 

Best Regards,

Lin

 

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.