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

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.