Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hi,
I want to create summary by CustomerId and last 6 Year-Month sales to check if customer if frequent buyer or not. Then I'll just COUNTROWS of that table and I'll get result. But it isn't that easy.
Code I wrote is following:
ADDCOLUMNS (
FILTER (
CROSSJOIN (
SUMMARIZE (
'Sales',
'Sales'[ClientID],
Clients[ClientType]
),
SUMMARIZE ( 'Sales', Date[Year-Month] )
),
Clients[ClientType] = "Shop" && "Somehow filter last 6 Year-Month"
),
"Sales", [Sales]
)
I've got no idea how to filter last 6 Year-Month in that code. Is there someone who can help?
Hi @piotr_gor ,
Please try to get the maximum month and store it in the variable:
VAR MaxYearMonth = MAX ( Date[Year-Month] )
Then pass the variable:
ADDCOLUMNS (
FILTER (
CROSSJOIN (
SUMMARIZE (
'Sales',
'Sales'[ClientID],
Clients[ClientType]
),
SUMMARIZE ( 'Sales', Date[Year-Month] )
),
Clients[ClientType] = "Shop" &&
Date[Year-Month] > MaxYearMonth - 6
),
"Sales", [Sales]
)
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 62 | |
| 53 | |
| 42 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 123 | |
| 105 | |
| 45 | |
| 32 | |
| 24 |