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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Table or Matrix with each month showing last 12 month of unique ID

Hi 

Is it possible to have a table of matrix that shows for each month the # of unique Cutomer ID for the last 12 months within each month. Example Jan-2021 value would show the # of unique customer ID over the last 12 calender month.

 

bu965_0-1619784974076.png

Thanks

1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

Did you have a calendar table. You need to build one and create an one to many relationship between it and your fact table.

 

Then you can use the following measure:

 

Measure =
VAR CURRENTDATE =
    MAX ( Date[Date] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( Sales[CustomerID] ),
        DATESINPERIOD ( 'Date'[Date], CURRENTDATE, -1, YEAR ),
        ALL ( Date )
    )

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

View solution in original post

2 REPLIES 2
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

Did you have a calendar table. You need to build one and create an one to many relationship between it and your fact table.

 

Then you can use the following measure:

 

Measure =
VAR CURRENTDATE =
    MAX ( Date[Date] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( Sales[CustomerID] ),
        DATESINPERIOD ( 'Date'[Date], CURRENTDATE, -1, YEAR ),
        ALL ( Date )
    )

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

Greg_Deckler
Community Champion
Community Champion

@Anonymous You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/m-p/434008



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.

Top Solution Authors
Top Kudoed Authors