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
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
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.

Top Solution Authors