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
vahrameev
Helper I
Helper I

Report showing future months

Hi

 

I'm new to Power Bi so please have mercy 🙂

 

My Power Bi is connected to Dynamics 365 Sales.

I'm trying to count total number of Leadid and every month should include data from all previous months.

In my case it looks like this:

 

Clipboard02.jpg

 

 

 

 

 

 

 

 

Count of leadid running total in Month = 
CALCULATE(
	COUNTA('leads'[leadid]),
	FILTER(
		CALCULATETABLE(
			SUMMARIZE(
				'leads',
				'leads'[createdon].[MonthNo],
				'leads'[createdon].[Month]
			),
			ALLSELECTED('leads')
		),
		ISONORAFTER(
			'leads'[createdon].[MonthNo], MAX('leads'[createdon].[MonthNo]), DESC,
			'leads'[createdon].[Month], MAX('leads'[createdon].[Month]), DESC
		)
	)
)

 

 

I don't know why but future months are also displayed in this case.

 

Is there an option to exclude these future months?

1 ACCEPTED SOLUTION

Hi @vahrameev ,

 

Sorry for the late reply!

Modify your measure as below:

Count of LeadID running total in Month = 
IF(MAX('Sheet1'[Created On].[MonthNo])<=MONTH(TODAY())&&YEAR(MAX('Sheet1'[Created On]))<=YEAR(TODAY()),
CALCULATE(
	COUNTA('Sheet1'[LeadID]),
	FILTER(
		CALCULATETABLE(
			SUMMARIZE(
				'Sheet1',
				'Sheet1'[Created On].[MonthNo],
				'Sheet1'[Created On].[Month]
			),
			ALLSELECTED('Sheet1')
		),
		ISONORAFTER(
			'Sheet1'[Created On].[MonthNo], MAX('Sheet1'[Created On].[MonthNo]), DESC,
			'Sheet1'[Created On].[Month], MAX('Sheet1'[Created On].[Month]), DESC
		)
	)
),
BLANK())

 

And you will see:

Screenshot 2020-10-29 145221.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

View solution in original post

6 REPLIES 6
vahrameev
Helper I
Helper I

Hi @v-kelly-msft 

Thank you very much for your answer!

This IF is exactly what I was missing.

amitchandak
Super User
Super User

@vahrameev , I case you have date in table try with a date table

 

Cumm Sales = CALCULATE(COUNTA('leads'[leadid]),filter(allselected(date),date[date] <=maxx(date,date[date])))
Cumm Sales = CALCULATE(COUNTA('leads'[leadid]),filter(allselected(date),date[date] <=max(Sales[Sales Date])))

@amitchandak  thank you very much for your reply

 

my dates are in the [createdon] field in Dynamics

 

but like I've said before I'm new to Power Bi so please be more specific where I should use your formulas

 

thank you

Hi @vahrameev ,

 

Could you pls upload your .pbix file to onedrive business and share the link with us?Remember to remove the confidential information.

Better attach the correct result.

 

 

Best Regards,
Kelly

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

Hi @v-kelly-msft 

Thank you for trying to help

 

This is an example of what I'm working with (extracted data from Dynamics to excel to show only necessary fields) https://1drv.ms/u/s!ApMveMy2oLCRhJoUC3B0UnISzmskxg?e=K2R9vb

 

I would like this report to show number of Leads created this month plus all he Leads created before (like it is showing now) but also not to display future months.

Hi @vahrameev ,

 

Sorry for the late reply!

Modify your measure as below:

Count of LeadID running total in Month = 
IF(MAX('Sheet1'[Created On].[MonthNo])<=MONTH(TODAY())&&YEAR(MAX('Sheet1'[Created On]))<=YEAR(TODAY()),
CALCULATE(
	COUNTA('Sheet1'[LeadID]),
	FILTER(
		CALCULATETABLE(
			SUMMARIZE(
				'Sheet1',
				'Sheet1'[Created On].[MonthNo],
				'Sheet1'[Created On].[Month]
			),
			ALLSELECTED('Sheet1')
		),
		ISONORAFTER(
			'Sheet1'[Created On].[MonthNo], MAX('Sheet1'[Created On].[MonthNo]), DESC,
			'Sheet1'[Created On].[Month], MAX('Sheet1'[Created On].[Month]), DESC
		)
	)
),
BLANK())

 

And you will see:

Screenshot 2020-10-29 145221.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

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.