Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi All
Can anyone help how to create measures for half-year sales like H1 and H2 for both Current year and Previous year please.
Thanks in Advance,
Sonia
Solved! Go to Solution.
To separate H1 (January to June) and H2 (July to December), you can use the MONTH function.
Create measures for H1 and H2 sales for the current year.
H1 Sales Current Year = CALCULATE( SUM(Sales[SalesAmount]), MONTH(Sales[Date]) <= 6, YEAR(Sales[Date]) = YEAR(TODAY()) ) H2 Sales Current Year = CALCULATE( SUM(Sales[SalesAmount]), MONTH(Sales[Date]) > 6, YEAR(Sales[Date]) = YEAR(TODAY()) )
To calculate for the previous year, modify the YEAR filter accordingly:
H1 Sales Previous Year = CALCULATE( SUM(Sales[SalesAmount]), MONTH(Sales[Date]) <= 6, YEAR(Sales[Date]) = YEAR(TODAY()) - 1 ) H2 Sales Previous Year = CALCULATE( SUM(Sales[SalesAmount]), MONTH(Sales[Date]) > 6, YEAR(Sales[Date]) = YEAR(TODAY()) - 1 )
If you'd like to create a combined measure for total half-year sales for both periods, you can sum up the respective measures:
Total H1 Sales = [H1 Sales Current Year] + [H1 Sales Previous Year] Total H2 Sales = [H2 Sales Current Year] + [H2 Sales Previous Year]
Please mark this post as solution if it helps you. Appreciate Kudos.
To separate H1 (January to June) and H2 (July to December), you can use the MONTH function.
Create measures for H1 and H2 sales for the current year.
H1 Sales Current Year = CALCULATE( SUM(Sales[SalesAmount]), MONTH(Sales[Date]) <= 6, YEAR(Sales[Date]) = YEAR(TODAY()) ) H2 Sales Current Year = CALCULATE( SUM(Sales[SalesAmount]), MONTH(Sales[Date]) > 6, YEAR(Sales[Date]) = YEAR(TODAY()) )
To calculate for the previous year, modify the YEAR filter accordingly:
H1 Sales Previous Year = CALCULATE( SUM(Sales[SalesAmount]), MONTH(Sales[Date]) <= 6, YEAR(Sales[Date]) = YEAR(TODAY()) - 1 ) H2 Sales Previous Year = CALCULATE( SUM(Sales[SalesAmount]), MONTH(Sales[Date]) > 6, YEAR(Sales[Date]) = YEAR(TODAY()) - 1 )
If you'd like to create a combined measure for total half-year sales for both periods, you can sum up the respective measures:
Total H1 Sales = [H1 Sales Current Year] + [H1 Sales Previous Year] Total H2 Sales = [H2 Sales Current Year] + [H2 Sales Previous Year]
Please mark this post as solution if it helps you. Appreciate Kudos.
Appreciate your help @FarhanJeelani
I have another issue in creating a measure to calculate sales for the remaining period of the year.
I am a beginner so please ignore my innonce when asking questions
I have table Sales which has data from 2022-1-1 until 2024-12-29 and I have to calculate Year-to-Go (YTG) Sales, I dont have goal/target value for 2024 and I donno how should I assume it.
Hi @SoniaShankar ,
No worries at all! Everyone starts somewhere, and asking questions is the best way to learn. Let me help you with your "Year-to-Go" (YTG) Sales calculation.
Since you don't have a specific goal or target value for 2024, you can calculate YTG Sales as the sum of sales for the remaining period of the current year based on today's date. Here's how you can do it using DAX:
YTG Sales = CALCULATE( SUM(Sales[SalesAmount]), Sales[Date] >= TODAY(), YEAR(Sales[Date]) = YEAR(TODAY()) )
Let me know if you need further clarification or adjustments! 😊
Please mark this post as solution if it helps you. Appreciate Kudos.
Thank you for being kind. @FarhanJeelani
Is it suppose to retrun any value, I dont see anything post 29 Dec 2024
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
17 | |
10 | |
10 | |
8 | |
6 |
User | Count |
---|---|
20 | |
18 | |
16 | |
13 | |
10 |