Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Solved! Go to Solution.
Hi @homelander123 ,
Thank you for reaching out to Microsoft Fabric Community.
Thank you @Shravan133 for the prompt response!!
Create a datetable using the DAX code below.
DateTable =
ADDCOLUMNS (
CALENDAR (DATE(2023, 1, 1), DATE(2025, 12, 31)),
"Year", YEAR([Date]),
"Month", FORMAT([Date], "MMMM"),
"YearMonth", FORMAT([Date], "YYYY-MM")
)
Next, establish a relationship between both tables. The tables should be related based on the date and CSM date columns. Then, use the measure below to achieve the expected results. The PBIX file is also attached for reference.
CMLYNAACount =
VAR SelectedDate = MAX('DateTable'[Date])
VAR LastYearStart = DATE(YEAR(SelectedDate) - 1, MONTH(SelectedDate), 1)
VAR LastYearEnd = EOMONTH(LastYearStart, 0)
RETURN
CALCULATE(
SUM(Query1[NACCount]),
FILTER(
ALL(Query1),
Query1[CSMDate] >= LastYearStart &&
Query1[CSMDate] <= LastYearEnd
)
)
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thank you!!
Hi @homelander123 ,
I hope the information provided is helpful. Feel free to reach out if you have any further questions or would like to discuss this in more detail. If responses provided answers your question, please accept it as a solution so other community members with similar problems can find a solution faster.
Thank you!!
Hi @homelander123 ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If the responses has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you!!
Hi @homelander123 ,
May I ask if the provided solution helped in resolving the issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you!!
Hi @homelander123 ,
Thank you for reaching out to Microsoft Fabric Community.
Thank you @Shravan133 for the prompt response!!
Create a datetable using the DAX code below.
DateTable =
ADDCOLUMNS (
CALENDAR (DATE(2023, 1, 1), DATE(2025, 12, 31)),
"Year", YEAR([Date]),
"Month", FORMAT([Date], "MMMM"),
"YearMonth", FORMAT([Date], "YYYY-MM")
)
Next, establish a relationship between both tables. The tables should be related based on the date and CSM date columns. Then, use the measure below to achieve the expected results. The PBIX file is also attached for reference.
CMLYNAACount =
VAR SelectedDate = MAX('DateTable'[Date])
VAR LastYearStart = DATE(YEAR(SelectedDate) - 1, MONTH(SelectedDate), 1)
VAR LastYearEnd = EOMONTH(LastYearStart, 0)
RETURN
CALCULATE(
SUM(Query1[NACCount]),
FILTER(
ALL(Query1),
Query1[CSMDate] >= LastYearStart &&
Query1[CSMDate] <= LastYearEnd
)
)
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thank you!!
Try this:
CMLYNAACount =
VAR SelectedMonth = MAX(Query1[CSMDate])
VAR LastYearSameMonthStart = EOMONTH(SelectedMonth, -12) + 1
VAR LastYearSameMonthEnd = EOMONTH(SelectedMonth, -12)
RETURN
CALCULATE(
SUM(Query1[NACCount]),
FILTER(
ALL(Query1),
Query1[CSMDate] >= LastYearSameMonthStart &&
Query1[CSMDate] <= LastYearSameMonthEnd
)
)
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |