cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ashwini12
Microsoft
Microsoft

I want to dynamically count distinct IDs with latest AuditCreated dates based on date slicer.

var maxValue =
CALCULATE(
MAX('View_AllHelpToolRequestsWithAudit (2)'[AuditCreatedDate]),
ALLEXCEPT('View_AllHelpToolRequestsWithAudit (2)','View_AllHelpToolRequestsWithAudit (2)'[Id]
),
DATESBETWEEN('View_AllHelpToolRequestsWithAudit (2)'[AuditCreatedDate],[Start Of Previous Period],[End Of Previous Period]),
DATESBETWEEN(Dim_Date[Date],[Start Of Previous Period],[End Of Previous Period]),
'View_AllHelpToolRequestsWithAudit (2)'[AuditNewStatusId] <> 3 || 'View_AllHelpToolRequestsWithAudit (2)'[AuditNewStatusId] <> 4 ,
'View_AllHelpToolRequestsWithAudit (2)'[AuditIsActive] = TRUE()
)
VAR colmax= MAXX('View_AllHelpToolRequestsWithAudit (2)','View_AllHelpToolRequestsWithAudit (2)'[AuditCreatedDate])
 
return

 

COUNTX(FILTER(VALUES('View_AllHelpToolRequestsWithAudit (2)'[Id]),maxValue <=colmax),'
View_AllHelpToolRequestsWithAudit (2)'[Id])
-----------------------------------------------------------------------------------------------------
I want to check only those records whose latest AuditCreated date range is between date range [Start Of Previous Period] to [End Of Previous Period]

---------------------------------------------------------------------------------------------------------------------------

Consider below scenario:
slicer  date range - 11 june to 11 july


ID  AuditCreatedDate Status IsActive
1     12 June                 open     True  
1     11 June                 open     True ---- max (+1)
1     10 June                 open     True
2     12 Aug                  open     True         
2     10 July                  open     True --- max (+1)
2      9 June                  open     True
3      13June                 open     True 

3      10 June                open     True -- ---max(+1)
3      6 June                  open     True


Ans: Previous Open ticket count = 3



2 REPLIES 2
daxer-almighty
Solution Sage
Solution Sage

Please rephrase the problem in clear, consise and comprehensible terms. Then you'll almost guaranteed to get an answer. This can help you: https://community.powerbi.com/t5/DAX-Commands-and-Tips/How-to-Get-Your-Question-Answered-Quickly/td-...

 

@daxer-almighty  Rephrased. 

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Top Solution Authors