cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cromero Regular Visitor
Regular Visitor

Count depening date

Hi all,

 

I'm trying to extract the KPI of Quality service. To extrat the % i need to count the total orders for the last day in the dataset and count the incidents for the last day too. The question is, I don't know how to count dependig to date in a measure.

To have the last day in the dataset doing a MAX of the date is enought but I don't know how to implement that in a measure to have this condition. 

 

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
themistoklis New Contributor
New Contributor

Re: Count depening date

@cromero

 

Maybe this formula is better:

 

Incidenciasultimodia =
VAR _Maxdate =
MAX ( 'Dataset'[Transformed DATA] )
RETURN
CALCULATE (
COUNT ( 'Dataset'[TIPO] );FILTER('Dataset';
'Dataset'[Transformed DATA] = _Maxdate || LEFT( 'Dataset'[TIPO], 2) = "AB"
))
5 REPLIES 5
themistoklis New Contributor
New Contributor

Re: Count depening date

@cromero

 

You can try the following measure:

 

Measure =
VAR _Maxdate =
    MAX ( 'Table'[Reference_Date] )
RETURN
    CALCULATE (
        COUNT ( 'Table'[Order_ID] ),
        'Table'[Reference_Date] = _Maxdate
    )

 

cromero Regular Visitor
Regular Visitor

Re: Count depening date

@themistoklis

 

Thanks for your help it helps a lot :-)

 

Related to that is it possible to add more conditions? for example now, i have the condition of the date but i want to add for example other like. Count if other column starts with AN por example.

 

 
Incidenciasultimodia =
VAR _Maxdate =
MAX ( 'Dataset'[Transformed DATA] )
RETURN
CALCULATE (
COUNT ( 'Dataset'[TIPO] );FILTER('Dataset';
'Dataset'[Transformed DATA] = _Maxdate || 'Dataset'[TIPO] = "AN%"
))
 

 

Now looks like this but is not working or showing an error

themistoklis New Contributor
New Contributor

Re: Count depening date

@cromero

 

No problem at all.

 

You can add other conditions as well.

I think the percenrage symbol is causing the error.

 

Change the formula to this one:

Incidenciasultimodia =
VAR _Maxdate =
MAX ( 'Dataset'[Transformed DATA] )
RETURN
CALCULATE (
COUNT ( 'Dataset'[TIPO] );FILTER('Dataset';
'Dataset'[Transformed DATA] = _Maxdate || SEARCH("AN", 'Dataset'[TIPO],,0) <> 0
))

 

themistoklis New Contributor
New Contributor

Re: Count depening date

@cromero

 

Maybe this formula is better:

 

Incidenciasultimodia =
VAR _Maxdate =
MAX ( 'Dataset'[Transformed DATA] )
RETURN
CALCULATE (
COUNT ( 'Dataset'[TIPO] );FILTER('Dataset';
'Dataset'[Transformed DATA] = _Maxdate || LEFT( 'Dataset'[TIPO], 2) = "AB"
))
Community Support Team
Community Support Team

Re: Count depening date

Hi @cromero,

 

Could you please mark the proper answers as solutions?

 

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.