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
TiaCamilian
Resolver I
Resolver I

Need to calculate base on DATESBETWEEN

I am new to Power BI and I am looking for the following solution:

 

I have a table with Date and Status

Example

 

Date Status

Dec-01-2010 Accepted

Jan-01-2011 Accepted

Jan-02-2011 Decline

Jan-03-2011 Accepted

Feb-01-2011 Accepted

Feb-02-2011 Decline

Mar-01-2012 Decline

 

I need to get the following result:

You can see that I only need the data with DATEBETWEEN Jan-01-2011 to Feb-02-2011.

 

Month #Total_Status #Accepted

Jan11 3 2

Feb11 2 1

 

Looks like I can use a New Messure to calculate by month the total number of Status and the total number of Accepted under status but needs to be only with the days between

 

 

 

1 ACCEPTED SOLUTION
Nathaniel_C
Super User
Super User

Hi @TiaCamilian ,

 


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

 

# of Accepted = 
var MinDate = MIN('Table'[Date])
var MaxDate = MAX('Table'[Date])

var CountStatus = CALCULATE(Counta('Table'[Status]),FILTER(All('Table'),'Table'[Date]>MinDate && 'Table'[Date]<MaxDate),'Table'[Status]="Accepted")

return CountStatus

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

# of Status = 
var MinDate = MIN('Table'[Date])
var MaxDate = MAX('Table'[Date])

var CountStatus = CALCULATE(Counta('Table'[Status]),FILTER(All('Table'),'Table'[Date]>MinDate && 'Table'[Date]<MaxDate))

return CountStatus

 

 

Countstatus.PNG

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
Nathaniel_C
Super User
Super User

Hi @TiaCamilian ,

 


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

 

# of Accepted = 
var MinDate = MIN('Table'[Date])
var MaxDate = MAX('Table'[Date])

var CountStatus = CALCULATE(Counta('Table'[Status]),FILTER(All('Table'),'Table'[Date]>MinDate && 'Table'[Date]<MaxDate),'Table'[Status]="Accepted")

return CountStatus

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

# of Status = 
var MinDate = MIN('Table'[Date])
var MaxDate = MAX('Table'[Date])

var CountStatus = CALCULATE(Counta('Table'[Status]),FILTER(All('Table'),'Table'[Date]>MinDate && 'Table'[Date]<MaxDate))

return CountStatus

 

 

Countstatus.PNG

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you for your help.

 

Do I create a new table or messure for your example.

 

Sorry I am new at this

Hi @TiaCamilian ,

 

Here is my pbix, Number accepted I didn't create a new table, just used your data. Did create two new measures. You should  be able to put your table and column names into my example and have it work.
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you for the solution and is working well

Nathaniel_C
Super User
Super User

@TiaCamilian ,

 

How do we tell that "You can see that I only need the data with DATEBETWEEN Jan-01-2011 to Feb-02-2011"?

Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.

Top Solution Authors