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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

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

@Anonymous

 

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"
))

View solution in original post

5 REPLIES 5
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

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

@Anonymous

 

You can try the following measure:

 

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

 

Anonymous
Not applicable

@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

@Anonymous

 

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
))

 

@Anonymous

 

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"
))

Helpful resources

Announcements
Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors