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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Grouping and count (On conditions & variables)

Hi all

 

I have a specific sitatution where I will see data that is 4 weeks old. And it would often chnage week to week (With the exception of the unique ID)

Then, based on certain criteria, I have to report on this infomration - Could you please give a few suggesitons?

Data:

SnapShot DateUnique IDProjectBaseline DateSlippedSlipped AmountStatus
04/05/2023123456Build House01/05/2023Yes-3Ongoing
11/05/2023123456Build House08/05/2023Yes-3Ongoing
18/05/2023123456Build House16/05/2023Yes-2Ongoing
25/05/2023123456Build House10/06/2023NoN/AOngoing

 

The Slipped is shoeing that the deadline was missed.

Now what I have to do, is Count how often this project 'Slipped in the last 4 Weeks (3)
Then count the total amount of Slipped Days (-8)
Then show this on 1 line on a Dashboard (Probablky Table or Matrix Table)

Considering I have 1000's of entries how can I best resolve this?

Thanks 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods. Create a new date table.
Table:

Date = CALENDAR(DATE(2023,5,1),DATE(2023,6,30))

Column:

Weeknum = WEEKNUM([Date],2)

vzhangti_0-1686119285367.png

vzhangti_1-1686119351406.png

Measure:

Count1 = Var _currentweek=WEEKNUM(TODAY())
return
CALCULATE(COUNT('Table'[Slipped]),FILTER(ALL('Table'),[Slipped]="Yes"),FILTER(ALL('Date'),[Weeknum]>=_currentweek-4))
Count2 = Var _currentweek=WEEKNUM(TODAY())
return
CALCULATE(SUM('Table'[Slipped Amount]),FILTER(ALL('Table'),[Slipped]="Yes"),FILTER(ALL('Date'),[Weeknum]>=_currentweek-4))

vzhangti_2-1686119428644.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

View solution in original post

1 REPLY 1
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods. Create a new date table.
Table:

Date = CALENDAR(DATE(2023,5,1),DATE(2023,6,30))

Column:

Weeknum = WEEKNUM([Date],2)

vzhangti_0-1686119285367.png

vzhangti_1-1686119351406.png

Measure:

Count1 = Var _currentweek=WEEKNUM(TODAY())
return
CALCULATE(COUNT('Table'[Slipped]),FILTER(ALL('Table'),[Slipped]="Yes"),FILTER(ALL('Date'),[Weeknum]>=_currentweek-4))
Count2 = Var _currentweek=WEEKNUM(TODAY())
return
CALCULATE(SUM('Table'[Slipped Amount]),FILTER(ALL('Table'),[Slipped]="Yes"),FILTER(ALL('Date'),[Weeknum]>=_currentweek-4))

vzhangti_2-1686119428644.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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