Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more
Hi! I am new to dax and I can't figure out why neither of this measures are working.
First measure:
PM Line_amt v2 = CALCULATE([Line_amt],PREVIOUSMONTH('Date'[Date]))Second measure:
PM line_amt =
SUMX (
VALUES ( 'Date'[Calendar YearMonthNumber] ),
VAR OffsetMonths = 1
VAR MonthDays =
CALCULATE ( VALUES ( 'Date'[Calendar MonthDays] ) )
VAR SelectedDays =
CALCULATE ( DISTINCTCOUNT ( 'Date'[Date] ) )
VAR PreviousMonthNumber = 'Date'[Calendar YearMonthNumber] - OffsetMonths
VAR PreviousMonthFull =
CALCULATE (
[Line_amt],
'Date'[Calendar YearMonthNumber] = PreviousMonthNumber,
ALL ( 'Date' )
)
VAR DaysInMonthSelected =
CALCULATETABLE ( VALUES ( 'Date'[Calendar DayOfMonthNumber] ) )
VAR PreviousMonthPartial =
CALCULATE (
[Line_amt],
'Date'[Calendar YearMonthNumber] = PreviousMonthNumber,
DaysInMonthSelected,
ALL ( 'Date' )
)
RETURN
IF ( MonthDays = SelectedDays, PreviousMonthFull, PreviousMonthPartial )
)I have an active relationship between fact table and dim date table:
Please help.
Solved! Go to Solution.
I realized, my measure was working. I just didnt have any date selected, so it wasnt showing previous month. I am closing my request. Thank you for you replay.
Hi @Dmoreira ,
Why do you say your measure not work?
More details will be much helpful.
If it is convenient, could you share some data sample which could reproduce your scenario and your desired output so that we could help further on it?
Best Regards,
Cherry
I realized, my measure was working. I just didnt have any date selected, so it wasnt showing previous month. I am closing my request. Thank you for you replay.
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 23 | |
| 23 | |
| 21 | |
| 17 | |
| 14 |
| User | Count |
|---|---|
| 58 | |
| 50 | |
| 37 | |
| 29 | |
| 24 |