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
Anonymous
Not applicable

Need to display count of each bucket based on max date

I have a source table, i have data available and need to display based on max date for each bucket

 

Col AColbdatebucket
111/11/20191
112/11/20192
113/11/20193
121/11/20191
122/11/20192
123/11/20193
124/11/20194
131/11/20191
132/11/20192
133/11/20193
134/11/20194
241/11/20191
242/11/20192
261/11/20191
262/11/20192
263/11/20193
371/11/20191

 

Need to display 

Col 1Bucket 1Bucket2Bucket 3Bucket 4
1  12
2 11 
31   

 

10 REPLIES 10
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?

 

Best regards,

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

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can create a measure using following formula based on your describion.

 

Count = 
VAR Bucket =
    MAX ( 'Table'[bucket] )
VAR ColA =
    MAX ( 'Table'[Col A] )
VAR MaxDate =
    CALCULATE (
        MAX ( 'Table'[date] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[bucket] = Bucket )
    )
RETURN
    COUNTROWS (
        FILTER (
            SUMMARIZE (
                FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Col A] = ColA ),
                [Colb],
                "Max", MAX ( 'Table'[date] )
            ),
            [Max] = MaxDate
        )
    )

 

Then we can put it into the Matrix Visual to meet your requirement.

 

3.PNG

 


BTW, pbix as attached.

 

Best regards,

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

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

Hi @v-lid-msft 

 

Thanks a lot for your time in exploring, am still trying for the options to display. 

To Give more precise am giving some sample data 

 

serial NumberPrd Numbucket_nametrans_date
19883.51839E+14B12/18/2019 0:00
19883.51839E+14B29/27/2019 0:00
19883.51839E+14B39/18/2019 0:00
19883.5482E+14B310/27/2019 0:00
1988R58M15Q60FDB12/22/2019 0:00
1988R58M15Q60FDB210/1/2019 0:00
1988R58M15Q60FDB310/11/2019 0:00
5483GG7XDNWCJF8MB11/24/2019 0:00
5483GG7XDNWCJF8MB29/18/2019 0:00
33783.54898E+14B12/18/2019 0:00
33783.54898E+14B29/15/2019 0:00
33783.54898E+14B39/25/2019 0:00
33793.53341E+14B13/1/2019 0:00

 

For each Serial, I have multiple Prd Num under various buckets..along with Date

I need to find the count of the number of Prd Num for each bucket based on Max(Date)

 

Then display the counts of each Prd Num on each bucket, on top should display the total count of each Bucket. 

 

Display Total1230
     
serial numB1B2B3B4
1988 12 
3378  1 
33791   
5483 1  

 

 

Please help me to reach this, Thanks A lot your time and support 

Hi @Anonymous ,

 

Sorry for late reply, we can create the following measure and use it in the matrix visual to meet you requirement:

 

 

count = 
VAR t =
    ADDCOLUMNS (
        GROUPBY ( ALLSELECTED ( 'Table' ), 'Table'[serial Number], 'Table'[Prd Num] ),
        "Bucket", CALCULATE (
            MAX ( 'Table'[bucket_name] ),
            FILTER (
                ALLSELECTED ( 'Table' ),
                'Table'[serial Number] = EARLIER ( 'Table'[serial Number] )
                    && 'Table'[Prd Num] = EARLIER ( 'Table'[Prd Num] )
                    && 'Table'[trans_date]
                        = CALCULATE (
                            MAX ( 'Table'[trans_date] ),
                            FILTER (
                                ALLSELECTED ( 'Table' ),
                                'Table'[serial Number] = EARLIER ( 'Table'[serial Number] )
                                    && 'Table'[Prd Num] = EARLIER ( 'Table'[Prd Num] )
                            )
                        )
            )
        )
    )
RETURN
    COUNTROWS (
        FILTER (
            t,
            [Bucket] IN FILTERS ( 'Table'[bucket_name] )
                && [serial Number] IN FILTERS ( 'Table'[serial Number] )
        )
    )

 

 

1.PNG

 


BTW, pbix as attached.

 

Best regards,

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

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

Hi @v-lid-msft ,

 

Thanks for the quick reply, am facing few errors while am applying the logic it is due to all my columns data type as Text 

 

Since where ever we are using EARLIER Function it's erroring out, 

 

As part of the solution, you have calculated count for all buckets and placed in Matrix, whereas I have to display the number of Prd Num on top as a scorecard. 

 

Really appreciate your help 

Hi @Anonymous ,

 

How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?

 

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

Hi @Anonymous ,

 

Based on my test, this formula should work when all the column is text, try to create measure instead of column, please put the error message after delete all confidential information if you still occor errors.

 

14.PNG15.PNG

 

"display the number of Prd Num on top as a scorecard. " , do you want to put the total above the column header or put them into another visual?


BTW, pbix as attached.

 

Best regards,

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

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

Hi, @sturlaws @v-lid-msft 

Possible please send me the reply, 

 

sturlaws
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

what is it that you need to display the max of? For each date, show the max of Col A?

 

Or, show the value of Col A at max date for the Col B-values?

 

Cheers,
Sturla

Anonymous
Not applicable

Count of Colb for a max of date column for relevant bucket 

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.