cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
froxas
Helper II
Helper II

how to count records at every stage filtered by their last stage

 

I have streaming dataset with following columns: title (drawing number), stage, date. Its production process when drawing goes through every stage. i need to show on  a chart how many drawings are at every stage at the time. it means drawings needs to be count by every stage, but the drawing can be only at last stage.

 

I atchieved it by creating separate table, but it does not fit to me as i will be posting chart on power bi online with stream dataset.

 

how could i atchieve it with "measure"?

 

Capture.PNG

5 REPLIES 5
v-yuta-msft
Community Support
Community Support

@froxas ,

 

Create a measure using DAX like pattern below:

 

Result =
CALCULATE ( COUNT ( Table[Stage] ), ALLEXCEPT ( Table, Table[Stage] ) )

Community Support Team _ Jimmy Tao

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

@v-yuta-msft thanks for you answer, but with this formula i get counted items in all stages, and i need to count only item in the last stage, or with the last recorded date.

 

For example: item1  goes through stage1, stage2 and stays in stage3. then item1 needs to be counted only in stage3. And below chart shows that item1 is counted in all these three stages.

 

 

Capture.PNG

@froxas ,

 

Have you solved your issue by now? If you have, could you please help mark the correct answer to finish the thread? Your contribution will be much appreciated.

 

Regards,

Jimmy Tao

@froxas ,

 

You may modify measure like this:

Result =
VAR Last_Stage =
    CALCULATE ( MAX ( Table[Stage] ) )
RETURN
    CALCULATE (
        COUNT ( Table[Stage] ),
        FILTER ( Table, Table[Stage] = Last_Stage )
    )

Community Support Team _ Jimmy Tao

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

@v-yuta-msft  Thanks for update your solution, but it does not work as expected (see below screenshot).

 

I gues it needs to be connected in a some way with "title" (drawing number), because for example for "stage 5" it needs to count all the drawings which last stage is "stage 5".  now if the draging stage is "stage 5" then it counts this drawing in all stages.

When i draw a chart i take two dimentions: stage and result.

 

 

powerbi_solution.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

P.S. during the process drawing goes through all the stages.

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors