cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MohamedSaleh
New Member

Calculated column to count rows per period

I have two tables, Account with their created date and a financial period table/Calendar with Quarters start and end date columns.

The two tables are not linked.

 

I'm trying to calculate infront of every period how many accounts were created in this period but Dax is not seeing the PeriodStartDate/PeriodEndDate columns. Any help would be appreciated. Thanks!

 

My attempt at it:

New Customers = CALCULATECOUNT(Account[Id]Account[CreatedDate] >= 'Finance Period'[PeriodStartDate] Account[CreatedDate] <= 'Finance Period'[PeriodEndDate])
1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @MohamedSaleh ,

 

You can create a new table visual and drag 'Finance Period'[PeriodStartDate], 'Finance Period'[PeriodEndDate] and this measure into the table visual.

 

New Customers = 
CALCULATE (
    COUNT ( 'Account'[Id] ),
    'Account'[CreatedDate] >= MAX('Finance Period'[PeriodStartDate]),
    'Account'[CreatedDate] <= MAX('Finance Period'[PeriodEndDate])
)

 

vcgaomsft_0-1670466306727.png

 

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

View solution in original post

1 REPLY 1
v-cgao-msft
Community Support
Community Support

Hi @MohamedSaleh ,

 

You can create a new table visual and drag 'Finance Period'[PeriodStartDate], 'Finance Period'[PeriodEndDate] and this measure into the table visual.

 

New Customers = 
CALCULATE (
    COUNT ( 'Account'[Id] ),
    'Account'[CreatedDate] >= MAX('Finance Period'[PeriodStartDate]),
    'Account'[CreatedDate] <= MAX('Finance Period'[PeriodEndDate])
)

 

vcgaomsft_0-1670466306727.png

 

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

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.