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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Alta88
Helper IV
Helper IV

KPI for Past & Upcoming Dates

I'm working on a KPI project that requires a chart showing how many homes are closing in each month. The idea is to display the Month number and Year Number for every month going back 12 months and going forward 6 months. (36 columns).

 

Here is a rough idea of what this should look like: 

 

Month NumberMonthYearClosing DateAccount NumberTotal Accounts
1January2021   
2February2021   
3March2021   
4April2021   
5May2021   
6June2021   
7July2021   
8August2021   
9September2021   
10October2021   
11November2021   
12December2021   
1January2022   
2February2022   
3March2022   
4April2022   
5May2022   
6June2022   
7July2022   
8August2022   
9September2022   
10October2022   
11November2022   

 

Obviously there would be several accounts and dates within each month too. My starting month/date would be May in this case so I've posted that range in the table above. What DAX formulas could accomplish this? 

1 ACCEPTED SOLUTION

Hi @Alta88 

 

You can create two columns in your table. 'Closing Data' is my table name, you can change it according to your table.

 
Year = YEAR('Closing Data'[Expected Closing Date])
Month = MONTH('Closing Data'[Expected Closing Date])
vjingzhang_0-1654676559757.png

 

Then go to report canvas, add a Table visual to the report. Select Year, Month and CustomerID_Txt columns to display in the table visual. In Columns well, right click on Year and select Don't summarize for it. Also select Don't summarize for Month. Select Count for CustomerID_Txt. Now the CustomerID_Txt column will have a column name "Count of xxxxxxx". You can use "Rename for this visual" option to change it to "Closing Count". 

vjingzhang_1-1654676844070.png

Hope this helps. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

11 REPLIES 11
Alta88
Helper IV
Helper IV

Yes, here's some mock data of the table I'm working with. I'm sending you a list of the closing home IDs along with their associated closing dates. 

 

CustomerID_TxtExpected Closing Date
45321546/11/2022
15886736/11/2022
21597836/13/2022
16875325/21/2022
54876215/21/2022
79543245/21/2022
25814969/1/2022
147963110/3/2022
36975217/21/2022
85274138/1/2022
32198748/1/2022
15912378/1/2022
98754318/26/2022
48654318/10/2022
89161329/1/2022
15987619/14/2022
167538910/6/2022
64571839/30/2021
78514326/30/2021
31857418/25/2021

 

 

As for the output, I'm not quite sure if we're going to do a slicer, although that's a great idea. For now we just want a standard table showing Month (number), Year, and Closing Count. 

Hi @Alta88 

 

You can create two columns in your table. 'Closing Data' is my table name, you can change it according to your table.

 
Year = YEAR('Closing Data'[Expected Closing Date])
Month = MONTH('Closing Data'[Expected Closing Date])
vjingzhang_0-1654676559757.png

 

Then go to report canvas, add a Table visual to the report. Select Year, Month and CustomerID_Txt columns to display in the table visual. In Columns well, right click on Year and select Don't summarize for it. Also select Don't summarize for Month. Select Count for CustomerID_Txt. Now the CustomerID_Txt column will have a column name "Count of xxxxxxx". You can use "Rename for this visual" option to change it to "Closing Count". 

vjingzhang_1-1654676844070.png

Hope this helps. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Thanks, Jing. This definitely worked. Now I'm verifying my total closings per each month. Something is off because PBI is showing count of total closings/accounts in May 2022 was 6,513, but when I downloaded it to Excel and counted it came to 4,744. Do I need to change the way the program is counting? Why is there such a discrepancy?

Hi @Alta88 

 

Do some CustomerIDs have multiple Expected Closing Dates in a month? What do you download to Excel and how do you count it in Excel? If you want to count the number of distinct customer IDs, you can try Count (Distinct) aggregation type. 

So I was able to verify a few things and it looks like the totals are accurate; the other datasets I was comparing them too were including other points that are not relevant to my table. Thanks for all the help!

Alta88
Helper IV
Helper IV

I've built columns looking back in time but once I get to 6 months ago (December 2021) it won't calculate. What am I missing?

Alta88_0-1654120354231.png

 

 

 

Alta88
Helper IV
Helper IV

Thanks Miguel. Looks like I got some clarification from the boss about what is needed. This is what he has in mind. So he wants me to build columns in the background to then arrive at a table that looks like the one below. 

 

fbcbef9c-7886-4156-b64f-16b3c7be3d4a.jpg

MFelix
Super User
Super User

Hi @Alta88 ,

 

Do you want to show the values based on the selection date of the and then present the value within the time range you have refer?

 

Believe you need to have a disconnected calendar table to get the slicer for the date selection.

 

Then you need to add something similar to this:

 

Houses =
COUNTROWS (
    FILTER (
        Table,
        Table[Date] >= DATEADD ( SlicerTable[Date], -12, MONTH )
            && Table[Date] <= DATEADD ( SlicerTable[Date], 6, MONTH )
    )
)

Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





Thanks, Miguel. 

 

Where it lists, 'table', is this referring to a table in my data set or is this just the word I use in the formula?

Hi @Alta88 ,

 

It's the table on your model you need to replace it by the correct names.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





Hi @Alta88 

 

Can you please provide some mock data of the original table you have? Do you already have the closing count number for every month in your table, or do you have a list of closing home IDs (or names) and their closing dates in your table? 

 

And for the expected output, do you want to have a slicer to pick a month, then go back/forward from that month? Or go back/forward from the current month (always based on today)?

 

Regards,
Community Support Team _ Jing

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.