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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
KH11NDR
Helper IV
Helper IV

Calculate current month with a different row previous month

Hi Guys,

 

How do i write a measure or calculated column to do this?  Thanks in advance.

 

 Jan Feb Mar Apr 
Total100150300699 
Revenue4090150549 I want the bold cell to calculate Current months Total - Last months revenue
      
1 ACCEPTED SOLUTION

Hi @KH11NDR,

 

I have made a test with your logic. 

 

I created a two calculated columns below and get the output.

 

last month revenue = CALCULATE(SUM('Table'[Previous Revenue Submitted (£)]),PREVIOUSMONTH('Master Calendar'[Date]))

Column = 'Table'[Commercial  Total]-[last month revenue]

 

Untitled.png

 

If you still need help, please share a dummy pbix file which can reproduce the scenario, so that we can help further investigate on it? You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading.)

 

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.

View solution in original post

6 REPLIES 6
KH11NDR
Helper IV
Helper IV

ProjectIDProjectDatePrevious Revenue Submitted (£)Commercial  Total
1aaa01/07/20180.001457068
2bbbb01/06/20173339.981457068

 

Date linked to a Date master calendar table, 

 

Master Calendar = ADDCOLUMNS ( CALENDAR (DATE(2017,01,01), DATE(2018,12,31)), "DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ), "Year", YEAR ( [Date] ), "MonthNo", FORMAT ( [Date], "MM" ), "YearMonthNo", FORMAT ( [Date], "YYYY/MM" ), "YearMonth", FORMAT ( [Date], "YYYY/mmm" ), "MonthShort", FORMAT ( [Date], "mmm" ), "MonthLong", FORMAT ( [Date], "mmmm" ), "WeekNo", WEEKNUM([Date]), "WeekDay", FORMAT ( [Date], "dddd" ), "WeekDayShort", FORMAT ( [Date], "dddd" ), "Quarter", "Q" & FORMAT ( [Date], "Q" ), "YearQuarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date], "Q" ), "Month Year", FORMAT ( [Date], "mmm") & " - " & FORMAT( [Date], "yy"))

 

I need this months commercial total - last months  Previous Revenue Submitted (£)

v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @KH11NDR,

 

I'm not very clear about your logic, could you describe your requirement in more details.

 

I would appreciate it if you could share your expected output.

 

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.
Greg_Deckler
Super User
Super User

What does your raw data look like? Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

ProjectIDProjectDatePrevious Revenue Submitted (£)Commercial  Total
1aaa01/07/20180.001457068
2bbbb01/06/20173339.981457068

 

Date linked to a Date master calendar table, 

 

Master Calendar = ADDCOLUMNS ( CALENDAR (DATE(2017,01,01), DATE(2018,12,31)), "DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ), "Year", YEAR ( [Date] ), "MonthNo", FORMAT ( [Date], "MM" ), "YearMonthNo", FORMAT ( [Date], "YYYY/MM" ), "YearMonth", FORMAT ( [Date], "YYYY/mmm" ), "MonthShort", FORMAT ( [Date], "mmm" ), "MonthLong", FORMAT ( [Date], "mmmm" ), "WeekNo", WEEKNUM([Date]), "WeekDay", FORMAT ( [Date], "dddd" ), "WeekDayShort", FORMAT ( [Date], "dddd" ), "Quarter", "Q" & FORMAT ( [Date], "Q" ), "YearQuarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date], "Q" ), "Month Year", FORMAT ( [Date], "mmm") & " - " & FORMAT( [Date], "yy"))

 

I need this months commercial total - last months  Previous Revenue Submitted (£)

I've tried PREVIOUSMONTH, still don't work.

 

PM **bleep** Revenue Submitted = CALCULATE([Sum of Cumulative Revenue Submitted],PREVIOUSMONTH('Calc Numbers'[Date]))

Hi @KH11NDR,

 

I have made a test with your logic. 

 

I created a two calculated columns below and get the output.

 

last month revenue = CALCULATE(SUM('Table'[Previous Revenue Submitted (£)]),PREVIOUSMONTH('Master Calendar'[Date]))

Column = 'Table'[Commercial  Total]-[last month revenue]

 

Untitled.png

 

If you still need help, please share a dummy pbix file which can reproduce the scenario, so that we can help further investigate on it? You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading.)

 

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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