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