cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
AshokkumarM
Frequent Visitor

Last Month and Last Year Same Month for both Fiscal and Calendar Month

Hi All, 

        Could you please help in below report , where a Last month and Last Year Same Month measure has to work for both Normal and Fiscal Calendar.

        Is there any way to add month format "YYYY-MM" in date dimension hierarchy??

Thanks in Advance,

Ashok kumar M

image.png

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @AshokkumarM,

 

The best way is to create your own hierachy dimension:

 

Just right click on the columns you want and choose New Hierarchy then just add all your columns in that hierarchy and add it to your visuals.

 

hier.gif

 

Regards,

MFelix

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

 

  1. Generate a date column from the Fiscal Month column using this formula (format this column as Date)

=1*(DATE(LEFT(Data[Fiscal Month],4),RIGHT(Data[Fiscal Month],2),1))

 

  1. Create a calendar table which has dates from the first date in the new column to the last date in the new column
  2. Create a relatioship from the new column of the Data Table to the Date column of the Calendar Table
  3. In the calendar table, write simple YEAR() and MONTH() functions to extract Month and Year
  4. Drag Year and Month from the calendar table to the visual
  5. Enter these formulas

=CALCULATE(SUM(Data[Sales]),PREVIOUSMONTH(Calendar[Date]))

=CALCULATE(SUM(Data[Sales]),SAMEPERIODLASTYEAR(Calendar[Date]))

 

Hope this helps.


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

My data is at date level only. I have used the PREVIOUSMONTH ,But when I use month code(YYYY-MM) derived from date the measure is not working

Hi,

 

Share the link from where i can download your file.  Also, show the expected result there.


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

Thanks! I got three Solution
MFelix
Super User
Super User

Hi @AshokkumarM,

 

The best way is to create your own hierachy dimension:

 

Just right click on the columns you want and choose New Hierarchy then just add all your columns in that hierarchy and add it to your visuals.

 

hier.gif

 

Regards,

MFelix

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors