The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I want to make a measurement that allows me to count the names of tasks like indicating on the red column using the second blue column named DateTime as a filter, indeed the data I want to visualize are the data of the last 24 hours. thank you for your help. So, as is shown in the picture the result will be 4.
My best regards. Thank you.
@Anonymous wrote:Hello,
I want to make a measurement that allows me to count the names of tasks like indicating on the red column using the second blue column named DateTime as a filter, indeed the data I want to visualize are the data of the last 24 hours. thank you for your help. So, as is shown in the picture the result will be 4.
The table structure you should probably have is this:
Task Name | Task Date | Task Time | Task Datetime (if you need this column)
Once you have these, you can define a measure:
[# Tasks] := DISTINCTCOUNT( Tasks[Task Name] )
When you create a pivot table and put [Task Date] on rows/columns, the measure will count the distinct names of the tasks that have this date in common.
Another possibility is that you just drag the Tasks[Datetime] column into a canvass and want to count the number of Tasks[Task Name] that have their Datetime within 24 hours (back in time) of the currently visible Datetime. In such a case you'd have to create a different measure:
[# Tasks Within 24 Hrs] := var __currentDatetime = SELECTEDVALUE( Tasks[Datetime] ) var __currentDatetimeMinus24Hrs = __currentDateTime - 1 -- returns the previous day at the same time var __measure = CALCULATE( [# Tasks], Tasks[Datetime] <= __currentDatetime, Tasks[Datetime] > __currentDatetimeMinus24Hrs ) return __measure
Best
Darek
User | Count |
---|---|
27 | |
12 | |
8 | |
8 | |
5 |
User | Count |
---|---|
31 | |
15 | |
12 | |
11 | |
7 |