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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

latest value text

I am trying to create the below table;

Superdeathmonke_0-1598284625302.png

 

i have the following data;

 

IdUsernameProduct IDProduct LevelDate

1John1High06 February 2020
2John1Low07 February 2020
3John2High25 February 2020
4Steve3Low18 February 2020
5Steve3High10 February 2020
6Steve4Low07 February 2020
7Steve4High06 February 2020
8Steve4None04 February 2020
9Steve5High24 February 2020
10Steve6Low

07 February 2020

 

So what the table is showing is based on the Max date i want to count the number of Product Ids per product level. So for example for Product ID 1 we have 2 different levels and different dates but i want to show in a chart just the latest date level for that specific product.

 

I am able to do this via calculated columns by saying whats the max date if the date equals the max date then product level but the issue with that is its not dynamic so woud not recalculate when i change date

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

You can create two measures as below, then create a bar chart with Product Level field on Axis fields and new measure “CountofPlevel" on Values field:

NProduct Level =
VAR _maxdate =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Product ID] = MAX ( 'Table'[Product ID] ) )
    )
RETURN
    CALCULATE (
        MAX ( 'Table'[Product Level] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Product ID] = MAX ( 'Table'[Product ID] )
                && 'Table'[Date] = _maxdate
        )
    )
CountofPlevel =
VAR _tab =
    SUMMARIZE ( 'Table', 'Table'[Product ID], "Npl", [NProduct Level] )
RETURN
    COUNTROWS ( FILTER ( _tab, [Npl] = MAX ( 'Table'[Product Level] ) ) )

latest value text.JPG

Best Regards

Rena

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

Please show the result in a simple table with an explanation.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@Anonymous , Try this measure

lastnonblank(Table[LevelDate],max(Table[Product ID]))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak thank you but tht wouldnt work as i need to count the number of product ids per  level this wouldnt allow me to do that

@Anonymous , Try

countx(filter(summarize(Table,table[user], table[product],table[Product Level],"_1", calculate(lastnonblankvalue(table[LevelDate],max(Table[Product Leve])),allexcept(Table,table[user], table[product]))) ,[_1] =[Product Level]),[product])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak thank you for this am i able to do a distinct count of this as we have multiple products Ids that are the same so only want to look at them onces as looking at that i have some 2's when doing a count against the Outlet IDs

Anonymous
Not applicable

Hi @Anonymous ,

You can create two measures as below, then create a bar chart with Product Level field on Axis fields and new measure “CountofPlevel" on Values field:

NProduct Level =
VAR _maxdate =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Product ID] = MAX ( 'Table'[Product ID] ) )
    )
RETURN
    CALCULATE (
        MAX ( 'Table'[Product Level] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Product ID] = MAX ( 'Table'[Product ID] )
                && 'Table'[Date] = _maxdate
        )
    )
CountofPlevel =
VAR _tab =
    SUMMARIZE ( 'Table', 'Table'[Product ID], "Npl", [NProduct Level] )
RETURN
    COUNTROWS ( FILTER ( _tab, [Npl] = MAX ( 'Table'[Product Level] ) ) )

latest value text.JPG

Best Regards

Rena

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.