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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Dmoreira
Frequent Visitor

Previous Month Showing Blank

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:Untitled.png

Please help.

1 ACCEPTED 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. 

View solution in original post

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

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

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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. 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.