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
tylesftw
Helper II
Helper II

Cumulative Sales - Getting the Sales Line to Stop

Hi All,

 

I've been given a dataset that has both Sales & Forecast in one dataset. This means that the below code does not work as it extends out the sales line to match the FY2020 months. Without duplicating the dataset, and stripping out Sales & Forecast into separate datas, is there a way to fix this quickly?

 

Cumulative.PNG

 

 

Cumulative Actuals =
VAR LastSalesDate = CALCULATE( MAX( 'Report Data'[Time] ), ALL( 'Report Data') )
 
RETURN
IF( SELECTEDVALUE( 'Date'[Date]) > LastSalesDate, BLANK(),
CALCULATE( [Total Sales] ,
FILTER( ALLSELECTED( 'Date'),
'Date'[Date] <= MAX( 'Date'[Date] ) )))
 
Thanks
Rob
7 REPLIES 7
v-jayw-msft
Community Support
Community Support

Hi @tylesftw ,

 

What's your Axis column?

Try create a measure like

If(selectedvalue(axis column)<=maxx(all(table),reportdate),1,0)

Then add the measure to visual filter measure is 1.

 

Best Regards,

Jay

 

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

Hi @tylesftw ,

 

Have your problem be solved?

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

I've parked it for the moment.. thanks for your help all

mahoneypat
Employee
Employee

You could add another IF() in your return such that if the MIN('Date'[Date]) is greater than your lastsalesdate variable to return blank(), otherwise your calculation.

 

If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


hmmmm 😞

amitchandak
Super User
Super User

@tylesftw ,The information you have provided is not making the problem clear to me. Can you please explain with an example.

Appreciate your Kudos.

Have added the visualisation.. essentially the data looks like

 

Time | Sales | Forecast

Jan   | $2$00 | $200

.

.

April | 0        | $30

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.