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
Anonymous
Not applicable

Calculating data of different ID based on different start date

Hi All, 

 

I'm trying to create a measure that will help me sum up the frequency of orders by customers starting from their respective start dates. 

The data are separated into two tables, I have created a many-to-one relationship from 'order date'[Customer ID] to 'register date'[Customer ID]. 

reggieveggie_1-1658301153293.png

 

 

The outcome of the measure should be able to reflect the total order as shown in the picture.

reggieveggie_0-1658300361443.png

 

Please help! Thank you! 

 

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

Hi @Anonymous ,

 

Please try:

 

Count_Date =

var _a = CALCULATE(DISTINCTCOUNT('Table (2)'[Order Date]))+0

var _b = CALCULATE(DISTINCTCOUNT('Table (2)'[Order Date]),FILTER('Table (2)',[Order Date]>=MAX('Table'[Register Date])))

return IF(ISINSCOPE('Table (2)'[Order Date]),_a,_b)

 

 

Use the matrix visual:

vjianbolimsft_0-1658486597499.png

 

Then change the format of the matrix

Turn off the Row subtotals:

vjianbolimsft_1-1658486597500.png

 

Change the name of Column subtotals:

vjianbolimsft_2-1658486597501.png

 

Turn off the step layout:

vjianbolimsft_3-1658486597502.png

 

Final Output:

vjianbolimsft_4-1658486597503.png

 

Best Regards,

Jianbo Li

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

View solution in original post

4 REPLIES 4
v-jianboli-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please try:

 

Count_Date =

var _a = CALCULATE(DISTINCTCOUNT('Table (2)'[Order Date]))+0

var _b = CALCULATE(DISTINCTCOUNT('Table (2)'[Order Date]),FILTER('Table (2)',[Order Date]>=MAX('Table'[Register Date])))

return IF(ISINSCOPE('Table (2)'[Order Date]),_a,_b)

 

 

Use the matrix visual:

vjianbolimsft_0-1658486597499.png

 

Then change the format of the matrix

Turn off the Row subtotals:

vjianbolimsft_1-1658486597500.png

 

Change the name of Column subtotals:

vjianbolimsft_2-1658486597501.png

 

Turn off the step layout:

vjianbolimsft_3-1658486597502.png

 

Final Output:

vjianbolimsft_4-1658486597503.png

 

Best Regards,

Jianbo Li

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

SpartaBI
Community Champion
Community Champion

@Anonymous you need to create a 1:m between Customer ID columns (first delete the relationship between the dates you created), and just create a simple measure like COUNTROWS('Orders Table Name') and put in a matrix next to the whatever columns you need from the customer table.


2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

Anonymous
Not applicable

Hi @SpartaBI ,

 

COUNTROWS will not work as I only need the total number of order after the customer's registration date. Is there any other ways to solve this? Thanks! 

@Anonymous please PM me with a link to zoom and teams and I will join

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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