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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
sd22
Frequent Visitor

Need Help with Dax

Hi All,

 

I need to present data in form of curr month -1 , curr month and curr month +1

Below is the dataset containing sales of prev month curr month and curr+1 month (predicted)

sd22_0-1698933019896.png

 

I want the data in to represent in the below pic in a table format in powerbi

 

sd22_1-1698933092006.png

 Can someone help me with dax of curr month -1 , curr month and curr month +1 .

 

Thanks

Shreyd22

 

3 REPLIES 3
sd22
Frequent Visitor

Hi mlsx4,
Thankyou for your response . But the data contains data for past 3 years and I only want to show data for curr month-1, curr month and curr month+1. It has to be dynamic . Can you kindly help me with that please.

 

Appricate your efforts.

 

Thanks & Regards

Shrey

Hi @sd22 

 

You can create an Offset column which does this:

 

Offset = 
var currentMonth= MONTH(TODAY())
return IF(MONTH(MyTable[Date])=currentMonth, 1 , IF(MONTH(MyTable[Date])=(currentMonth-1),1, IF(MONTH(MyTable[Date])=(currentMonth+1),1,0)))

And then put a filter in the pane for your graph <Offset=1> 

mlsx4
Super User
Super User

Hi @sd22 

 

If your data is as you have put, then you only need to use a matrix to visually see it as you need:

1) Put in rows: Item

2) Put in columns: Month

3) Put in values: Quantity

 

mlsx4_0-1698938643001.png

 

Btw, you can disable totals

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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