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
akhancertus
Frequent Visitor

Filter data from table where date is less then date from report filter

Hi,

I have scenario where Sales amount should be display based on the report filter.  Example we have sales data on monthly basis and user can select a month from report filter.  Related information is showing perfectly except one column which shows total sales as of the date (accumulated total as of selected date) which is selected at report filter.

 

We have two tables, one is fiscal year:

Year ID              2018

Month Name   Jan-2018, Feb-2018, March-208.....

Period ID         1,2,3,4/.......

 

Second table : sales table

Month Name   Jan-2018. Feb-2018, Mar-2018.....

Period              1,2,3......

Sales Value      $$$$,$$$$,$$$$

 

Now when user select Mar-2018 from report filter, accumulated value should show (Jan2018 + Feb-2018 + Mar-2018) and if user select June-2018 then (Jan to June).

 

Please help.

 

1 ACCEPTED SOLUTION
v-danhe-msft
Employee
Employee

Hi @akhancertus,

Based on my test, you could refer to below formula:

Amount running total in Date = 
CALCULATE(SUM(Sales[Sales Value]),FILTER(ALL('Sales'),'Sales'[Month Name]<=SELECTEDVALUE('Sales'[Month Name])))

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
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

2 REPLIES 2
v-danhe-msft
Employee
Employee

Hi @akhancertus,

Based on my test, you could refer to below formula:

Amount running total in Date = 
CALCULATE(SUM(Sales[Sales Value]),FILTER(ALL('Sales'),'Sales'[Month Name]<=SELECTEDVALUE('Sales'[Month Name])))

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

Seems like you need a simple running total, something like:

 

Amount running total in Date = 
CALCULATE(
	SUM('Sample'[Amount]),
	FILTER(
		ALLSELECTED('Sample'[Date]),
		ISONORAFTER('Sample'[Date], MAX('Sample'[Date]), DESC)
	)
)

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.