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
Anonymous
Not applicable

cumulative skipping values if cy date sales are blank

sales CY vsLY.JPGI am calculating cumulative sales for the month selected 

 

Cumulative Amount CY = CALCULATE([Total Sales],
FILTER(ALLSELECTED(FSP),
FSP[Date_dt]<= MAX(FSP[Date_dt] ) && YEAR(FSP[Date_dt])=YEAR(TODAY())))

 

Cumulative Amount PY = CALCULATE([total sales ly],
FILTER(ALLSELECTED(FSP),
FSP[Date_dt]<= MAX(FSP[Date_dt] ) ))

 

-----

 

when u look at this for CY its fetching correct values , but for LY it is skipping the values if CY data is blank 

 

eg. 10 nov 2018  is sunday and sales is blank 

but 10 nov 2017 has sales 332353.67 which is missing in the calculation of cumulative amountPY so the amount is not matching missing values.JPG

 

Calculated measure:

(total sales ly = CALCULATE(SUM(FSP[Sales]),SAMEPERIODLASTYEAR(FSP[Date_dt].[Date]),ALL(FSP)) )

 

please can you help me out 

 

Thanks in advance 

2 REPLIES 2
v-yuezhe-msft
Employee
Employee

@Anonymous,

Please create a specific calendar table in Power BI Desktop following the guide in this blog, then replace the date fields in the above DAX formula to Date field of Calendar table. After that , drag date fields of Calendar table to your visuals and check if the result of your measure is correct.

If you still get incorrect result, please share sample data of your table that can by copied and pasted.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Can anyone please help

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.