cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
leahschneider
Helper III
Helper III

How to get list of new items per month

I can't seem to find an answer that works for this. Basically I have a table that looks like this:

Date Item Order
6/1/22 Bike 50
6/1/22 Tire 1
6/1/22 Bike 25
6/1/22 Shirt 40
5/1/22 Shirt 10
5/1/22 Shirt 1
4/1/22Hat 15

 

I'd like to see something that shows the new items per month concatenated like below:

Date New Items
6/1/22 Bike, Tire
5/1/22 Shirt
4/1/22 Hat

 

Can someone help with this?

1 ACCEPTED SOLUTION
ppm1
Solution Sage
Solution Sage

Please try this measure expression.

NewItems =
VAR thisdate =
    MAX ( Orders[Date] )
VAR newitemstable =
    FILTER (
        DISTINCT ( Orders[Item] ),
        ISBLANK (
            CALCULATE (
                COUNTROWS ( Orders ),
                ALL ( Orders[Date] ),
                Orders[Date] < thisdate
            )
        )
    )
RETURN
    CONCATENATEX ( newitemstable, Orders[Item], ", " )

ppm1_0-1672281734629.png

 

Pat

Microsoft Employee

View solution in original post

4 REPLIES 4
ppm1
Solution Sage
Solution Sage

Please try this measure expression.

NewItems =
VAR thisdate =
    MAX ( Orders[Date] )
VAR newitemstable =
    FILTER (
        DISTINCT ( Orders[Item] ),
        ISBLANK (
            CALCULATE (
                COUNTROWS ( Orders ),
                ALL ( Orders[Date] ),
                Orders[Date] < thisdate
            )
        )
    )
RETURN
    CONCATENATEX ( newitemstable, Orders[Item], ", " )

ppm1_0-1672281734629.png

 

Pat

Microsoft Employee

This worked but with FIRSTDATE instead of MAX. Max created incorrect rollups.

I'd like to add for future reference that I couldn't get this to work in my actual table which is a big and complicated fact table so I created a small table with summarize to get just the fields I wanted.

Arul
Super User
Super User

@leahschneider ,

try this formula in measure,

 

Concatenate = 
CALCULATE (
    CONCATENATEX ( DISTINCT ( 'Samp Table1'[Item ] ), 'Samp Table1'[Item ], "," ),
    ALLEXCEPT ( 'Samp Table1', 'Samp Table1'[Date ] )
)

 

Arul_0-1672256869953.png

Thanks,

Arul





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




That's incorrect even in your picture. I only want new items for that month, not a distinct list of all items. Your solution has Shirt in June and in May and I only want to see it in May.

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors