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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
parissap
Frequent Visitor

Calculating sum of value with filter on date and year as legend

Hi

I want to see the year-to-date sales amount per customer and year in a column chart. I used this formula 

CALCULATE(
    sum(UnifiedData[value]),
     VALUES(UnifiedData[Year]),
    filter( UnifiedData,UnifiedData[delivery day customer]<today()  )
)
Where value is the sale amount, I have the customer in my X axis and the year as a legend. The formula returns the correct value for the current year, but for last years, It's cumulative with the current year, and I don't know how to limit it per year. 
Please help me.
 Thanks
1 ACCEPTED SOLUTION
v-zhouwen-msft
Community Support
Community Support

Hi @parissap ,

The table data is shown below:

vzhouwenmsft_0-1708397364153.png

Please follow these steps:
1. Use the following DAX expression to create a measure named ‘SumSales ’

SumSales =
CALCULATE (
    SUM ( UnifiedData[value] ),
    FILTER ( 'UnifiedData', 'UnifiedData'[delivery day customer] < TODAY () )
)

2. Use the 'Year' column to create a slicer

vzhouwenmsft_0-1708397462885.png

 

vzhouwenmsft_1-1708397470655.png

3. Final output

vzhouwenmsft_2-1708397499727.png

 

vzhouwenmsft_3-1708397509680.png

vzhouwenmsft_4-1708397518112.png

vzhouwenmsft_5-1708397522983.png

 

Best Regards,
Wenbin Zhou
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

1 REPLY 1
v-zhouwen-msft
Community Support
Community Support

Hi @parissap ,

The table data is shown below:

vzhouwenmsft_0-1708397364153.png

Please follow these steps:
1. Use the following DAX expression to create a measure named ‘SumSales ’

SumSales =
CALCULATE (
    SUM ( UnifiedData[value] ),
    FILTER ( 'UnifiedData', 'UnifiedData'[delivery day customer] < TODAY () )
)

2. Use the 'Year' column to create a slicer

vzhouwenmsft_0-1708397462885.png

 

vzhouwenmsft_1-1708397470655.png

3. Final output

vzhouwenmsft_2-1708397499727.png

 

vzhouwenmsft_3-1708397509680.png

vzhouwenmsft_4-1708397518112.png

vzhouwenmsft_5-1708397522983.png

 

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

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.