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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
OEUSOC
Frequent Visitor

Count times product was purchased over last 5 years based off individual transaction.

Hello,

 

I have a slicer setup to show transactions over the last one calendar week.

This works great to show the product that was purchased on that transaction.

However, I would also like a visual to show how many times that product was purchased over the last 5 years.

Any help is greatly appreciated.

PowerBI.jpg

6 REPLIES 6
OEUSOC
Frequent Visitor

It's a single table with 'Transaction#' as the unique identifier. I'm using a on the slicer that shows relative date, last one calendar week. I coped a column for 'TransactionDateTime' and transformed it to date only which is what you see in the screenshot above (and what I am also using in the slicer filter) . I want to display some specific transaction data along with some weekly data which I have been able to do. The last thing I need to do is show how many times that product has been purchased over the last 5 years.

AlB
Community Champion
Community Champion

@OEUSOC 

Try this measure in a card visual

Measure =
VAR baseDate_ = [TransactionDate] //The measure you already have and show in the card visual
VAR startOfPeriod_ =
    EDATE ( baseDate_, -5 )
VAR product_ = [Product] //The measure you already have and show in the card visual at the top
RETURN
    CALCULATE (
        DISTINCTCOUNT ( Table1[Transaction#] ),
        FILTER ( ALL ( DateT ), DateT[Date] >= startOfPeriod_ )
    )

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

 

AlB
Community Champion
Community Champion

@OEUSOC 

I wasn't notified of your last response. Seems to be a problem with the notifications.

[Product] = SELECTEDVALUE( Table1[ProductID] )
[TransactionDate] = SELECTEDVALUE( Table1[TransactionDate] )

If you share the pbix it would be easier to come up with a more accurate solution

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

OEUSOC
Frequent Visitor

Thanks AIB.

I do not have 'TransactionDate' and 'Product' setup as measures. They're simply fields from the table.

I wouldn't even begin to know how to make those measures in this case. Maybe I'm biting off more than I can chew right now.

Hi @OEUSOC ,

 

If possible,could you pls upload your .pbix file to onedrive business and share the link with us?

Remember to remove the confidential information.

 

Best Regards,
Kelly

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

AlB
Community Champion
Community Champion

Hi @OEUSOC 

What field(s) define how many times a product was purchased? Waht are you using to specify the week, a slicer of a field of a date table? It would help if you show a sample of the relevant tables

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.