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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
reggieveggie
New Member

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 @reggieveggie ,

 

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 @reggieveggie ,

 

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

@reggieveggie 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

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! 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors