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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ymirza
Helper II
Helper II

Measure for Count of opened items during last 30 days

I am looking for DAX that will count the number of Opened tasks during the last 30 days and 90 days. 

 

I have this simple table below

 

TaskCreated
Opened 01-Dec
Closed02-Dec
Closed02-Dec
Closed04-Dec
Opened 05-Dec
Opened 06-Dec
Opened 07-Dec

 

I will use Card to display this count

1 ACCEPTED SOLUTION

@ymirza

 

Try this:

 

Last 30 days =
CALCULATE (
     COUNT( Table[Task_ID] ),
              FILTER (
                   ALL ( Table ),
                  Table[date]
                   >= MAX ( Table[date] ) - 30
                   && Table[date] <= MAX ( Table[date] )
                   && Table[Task] = BLANK()
                           )
)

 

OR 

 

Last 30 days =
CALCULATE (
     COUNT( Table[Task_ID] ),
              FILTER (
                   ALL ( Table ),
                  Table[date]
                   >= MAX ( Table[date] ) - 30
                   && Table[date] <= MAX ( Table[date] )
                   && LEN[Task] = 0
                           )
)

View solution in original post

5 REPLIES 5
themistoklis
Community Champion
Community Champion

@ymirza

 

try this formula

 

Last 30 days =
CALCULATE (
     COUNT( Table[Task_ID] ),
              FILTER (
                   ALL ( Table ),
                  Table[date]
                   >= MAX ( Table[date] ) - 30
                   && Table[date] <= MAX ( Table[date] )
                   && Table[Task] = "Opened"
                           )
)

 

@themistoklis, thank for quick response. What is the Table[value] you are using from? i dont have any such column

@ymirza

 

I have amened the previous formula,

 

I have put task_Id instead of value and count instead os SUM.

In other words this is the place where you count the number of tasks.

I dont know which field identifies the tasks so i have just put Task_ID (which you can replace with the relevant field)

Thanks @themistoklis, it is working now. Can you also amend for values returning Blank?

@ymirza

 

Try this:

 

Last 30 days =
CALCULATE (
     COUNT( Table[Task_ID] ),
              FILTER (
                   ALL ( Table ),
                  Table[date]
                   >= MAX ( Table[date] ) - 30
                   && Table[date] <= MAX ( Table[date] )
                   && Table[Task] = BLANK()
                           )
)

 

OR 

 

Last 30 days =
CALCULATE (
     COUNT( Table[Task_ID] ),
              FILTER (
                   ALL ( Table ),
                  Table[date]
                   >= MAX ( Table[date] ) - 30
                   && Table[date] <= MAX ( Table[date] )
                   && LEN[Task] = 0
                           )
)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.