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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Power_Guy
Regular Visitor

Dynamic Dax for Previous

Hi
I am trying to return previous year quarter value  however only for one area dax is showing 0 

Power_Guy_0-1739532309555.png

I wanted to modify my dax for Promote Previous measure Promote current is the first measure 
Promote Current is finding the maximum value across the quarter
For Instance : For 2028/q1 promote previous value should show 16538747.92 not

I am attaching expected out put 

Power_Guy_1-1739532766734.png



This is the dax which i used to create previous value

VAR PrevValue =
    CALCULATE(
        CALCULATE(MAX('Promote'[Promote (Advances)])),
        FILTER(
            ALL('Date'),
            'Date'[Period] < MAX('Date'[Period])
        )
    )
RETURN
    IF(
        ISBLANK(PrevValue),
        0,
        PrevValue
    )


Any help will be much appreciated.



 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Power_Guy 

If "Tax Distribution/Promote" is a column then you need to remove the filter from this column by wrapping it with ALL and include it as one of the CALCULATE arguments. 

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

This pattern should work

Measure = calculate([promote current],previousquarter(calendar[date]))

Ensure that you drag quarter to the table visual from the Calendar table.  If this does not help, then share the download link of the PBi file and the problem there very clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
tamerj1
Super User
Super User

Hi @Power_Guy 

If "Tax Distribution/Promote" is a column then you need to remove the filter from this column by wrapping it with ALL and include it as one of the CALCULATE arguments. 

rajendraongole1
Super User
Super User

Hi @Power_Guy  - Your current DAX formula does not explicitly filter for the previous quarter within the same category. Instead, it looks at the entire date table and finds the max value before the current period

 

please find the revised measure as below:

Promote Previous =
VAR CurrentQuarter = MAX('Date'[Period])
VAR PreviousQuarter =
CALCULATE(
MAX('Date'[Period]),
FILTER(
ALL('Date'),
'Date'[Period] < CurrentQuarter
)
)
RETURN
CALCULATE(
MAX('Promote'[Promote (Advances)]),
FILTER(
ALL('Date'),
'Date'[Period] = PreviousQuarter
)
)

 

check it , hope it works.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors