Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
92 views
in Power BI by 27 30 39
edited by

I have a sales dataset in Power BI, and I want to create a measure to calculate the sales amount from the beginning of the year up to the specified date.. The dataset includes columns for dates and sales amounts. How can I achieve this using DAX?

 


1 Answer

1 like 0 dislike
by 164 218 436
selected by
 
Best answer

How to Calculate Total Year Sales Using DAX in Power BI

You can use the TOTALYTD DAX function to calculate YTD sales.

DAX Measure:

YTD Sales = TOTALYTD(SUM(Sales[SalesAmount]), Dates[Date])

Explanation:

  • TOTALYTD: Calculates the running total from the beginning of the year up to the specified date.
  • SUM(Sales[SalesAmount]): Aggregates the sales amount.
  • Dates[Date]: The date column from the calendar table in your dataset.

Make sure your date column is connected to a proper Date Table, and the table is marked as a Date Table in Power BI.

by 27 30 39
0 0
Thanks Mohamed for this great explanation!
If you don’t ask, the answer is always NO!
...