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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Pooji
Regular Visitor

Current Date and Last date of the previous quarter

Hi All,

 

I am trying to get the current/highest date and last date of the previous quarter available. 

 

Pooji_0-1634125029377.png

Here is my data. Please help me in wriring dax for this.

 

Thanks,

Pooji

6 REPLIES 6
Pooji
Regular Visitor

Hi @Fowmy 

 

I am able to get the data as below:

 

Pooji_0-1634213737618.png

here is the dax i have used for getting that:

 

Latest Quarter = if( 'Historical Performance by Fund'[Date]=max('Historical Performance by Fund'[Date]),1,0)
Finallastdayprevdate = if( 'Historical Performance by Fund'[Date]=max('Historical Performance by Fund'[Previous year]),1,0)

Previous year = DATE ( YEAR ( 'Historical Performance by Fund'[date] ) -1, 12, 31 )
 
Now i am trying to get this combined (both the latest and previous year).
 
Final Date = if(AND('Historical Performance by Fund'[Date]=max('Historical Performance by Fund'[Date]),1),
if(AND( 'Historical Performance by Fund'[Date]=max('Historical Performance by Fund'[Previous year]),1,0)))
 
But this is not working. Am getting error. Kindly help!!
 
Thanks in advance,
Pooji

 

 

Pooji
Regular Visitor

Well! This is wroking but my requirement is different.

 

I have a page level filter applied based on fund column.

 

Pooji_0-1634131329399.png

 

Am unable to attach the pbix file here. So attaching the screenshot.

 

My X- Axis should be able to show the current date and last date of previous quarter. Y - Axis has 3 columns as shown above.

 

Thanks,

Pooji

@Pooji 

Save your file in Google or One Drive and share the link here

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Fowmy
Super User
Super User

@Pooji 

The question is not clear enough, better if you could provide data and the expected results. Anyhow,  you can use the following measure to get the last date of the previous quarter.

 

Last Date Prev Qtr = MAXX( PREVIOUSQUARTER('Dates'[Date]) , Dates[Date] )





Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Pooji
Regular Visitor

Hi @Fowmy 

 

I am trying to replicate the below bar chart.

Pooji_0-1634126380799.png

The left side 2 bars should be shown with last quarter  of previous year.

 

And the right side 2 bars should be shown based on current or highest date available.

 

Here is the data:

 

Pooji_1-1634126520090.png

 

Eg: As per the data, it should show the last 2 rows - Q4 2020 and Q1 2021. And the data related to these 2 rows.

 

Thanks,

Pooji.

 

@Pooji 

Create the following two measures, it will give you the Lates Quarter total and last quarter in the previous year.  

Latest Cost = 
VAR __MaxDate = CALCULATE( MAX(Table3[Date]) , REMOVEFILTERS( Table3)) RETURN
CALCULATE(
    SUM(Table3[Cost]),
    Table3[Date] = __MaxDate
)
Prev Year Last Qtr  Cost = 
VAR __MaxDate = CALCULATE( MAX(Table3[Date]) , REMOVEFILTERS( Table3)) 
VAR __LyLastQtr =  
    CALCULATE(
        MAX(Table3[Date]),
        FILTER( all(Table3[Date]) , YEAR(Table3[Date]) = YEAR(__MaxDate)-1),
         REMOVEFILTERS( Table3)
    )
RETURN
CALCULATE(
    SUM(Table3[Cost]),
    Table3[Date] = __LyLastQtr ,
    REMOVEFILTERS(Table3)
)

Fowmy_0-1634128997792.png


You can create a dummy table to get the same layout as per your example chart.

I attached the file below.

 







Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.