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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Previous Month in Direct Query Mode

Hi Experts

 

I am struggling to get the previous month DAX Measure to Work in DQ Mode. My measure is

Internet Sales last Month = 
CALCULATE(
    [Internet Sales],
    PARALLELPERIOD(
        DimDate[FullDateAlternateKey],
        -1,
        MONTH)
)

 The measure is not returning back any values

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@Anonymous As @aj1973 stated, TI functions have limitations with DQ, which is one of the reasons I find them generally useless. You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

 

In your case, you could get previous month this way:

Internet Sales last Month measure = 
  VAR __Date = MAX('DimDate'[FullDateAlternateKey])
  VAR __LastMonthEnd = EOMONTH(__Date,-1)
  VAR __LastMonthBegin = DATE(YEAR(__LastMonthEnd),MONTH(__LastMonthEnd),1)
RETURN
CALCULATE(
    [Internet Sales],
    DimDate[FullDateAlternateKey] >= __LastMonthEnd,
    DimDate[FullDateAlternateKey] <= __LastMonthBegin
)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@Anonymous As @aj1973 stated, TI functions have limitations with DQ, which is one of the reasons I find them generally useless. You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

 

In your case, you could get previous month this way:

Internet Sales last Month measure = 
  VAR __Date = MAX('DimDate'[FullDateAlternateKey])
  VAR __LastMonthEnd = EOMONTH(__Date,-1)
  VAR __LastMonthBegin = DATE(YEAR(__LastMonthEnd),MONTH(__LastMonthEnd),1)
RETURN
CALCULATE(
    [Internet Sales],
    DimDate[FullDateAlternateKey] >= __LastMonthEnd,
    DimDate[FullDateAlternateKey] <= __LastMonthBegin
)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
aj1973
Community Champion
Community Champion

Hi @Anonymous 

In DQ mode there are limitations, like using Time Intelligence functions, please take a look at this comparison.

aj1973_0-1631796544653.png

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Anonymous
Not applicable

Hi Amine - It must be possible to compute the Previous Value by alternative means???

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors