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
Community Champion
Community Champion

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
Community Champion
Community Champion

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
Community Champion
Community Champion

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




avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)