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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Anonymous
Not applicable

month dax

Hello!

First, I wish to apologize for my English.

I am new to power bi and I would like some help on a DAX function.

In my file I have two columns, a column ("needs") with the quantities of the needs and another column date ("date of need") which shows me the date for which I need them.

I am looking for a function dax, which gives me the needs M + 1, M + 2, M + 3 ... according to today compared to my two columns.

I hope my question is understandable

 

 

1 ACCEPTED SOLUTION

Hi @Anonymous 

calculated column is static, it doesn't change through dates.

measure can't be added to the column header of the matrix.

So i'm afraid it is impossible as you expected.

 

We can only add "date" column in the column header.

month dax = IF(DATEDIFF(TODAY(),MAX('Table'[date]),MONTH)>=1,FORMAT([today],"mmmm")&" M"&"+"&DATEDIFF(TODAY(),MAX('Table'[date]),MONTH))

Capture21.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
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

5 REPLIES 5
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Which output would you like?

I create a measure

month dax = IF(DATEDIFF(TODAY(),MAX('Table'[date]),MONTH)>=1,"M"&"+"&DATEDIFF(TODAY(),MAX('Table'[date]),MONTH))

Capture3.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hello @

 

Thank you for your formula,

That is exactly what I wanted, but would it be possible to add the months in column ? ( to create a new column column for later)

Here is the current example that I have :

image.png

I want to create a column that meets all needs per month (M + 1 N, M + 1 N + 1, ...)

Here is an example of what I would like:

image.png

 is it possible ?

Thanks !!

Hi @Anonymous 

calculated column is static, it doesn't change through dates.

measure can't be added to the column header of the matrix.

So i'm afraid it is impossible as you expected.

 

We can only add "date" column in the column header.

month dax = IF(DATEDIFF(TODAY(),MAX('Table'[date]),MONTH)>=1,FORMAT([today],"mmmm")&" M"&"+"&DATEDIFF(TODAY(),MAX('Table'[date]),MONTH))

Capture21.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi,

 

You would need to use the Function Month() to get the Month for the Date. Add this as a new column in the Table. Once this is done, You will need to Unpivot the Table. You could do this by Edit Queries -> Select the Column of the Table that You want to Unpivot -> Transform -> Unpivot Columns.

 

Best Regards,
Vignesh M

If what I suggested worked for you feel free to Drop a "Kudos" and Consider to "Accept as Solution" if I solved your Issue 🙂

Anonymous
Not applicable

Hello Mvignesh53,

 

I tried your solution, I just have a little problem :

when I unpivot the column month [month()] I can not get the desired result.

 

image.png

I want the months in columns, the results of these columns show me the needs by month, and by article code, (I cannot display the item codes in the capture, because they are confidential)

 

Thanks for your help !

 

 

 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.