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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
tksnota
Post Patron
Post Patron

Need Assistance on M Code

Hi,

 

Is it possible to create M or SQL Code wherein if any of the StartDate, EndDate or Reporting Month were changed then a refreshed was done the data would only covered what was specified. Eg. Reporting Date is 31/10/24 then only data on or before this date anything after will not be displayed?

 

It will also need to updat the date on F4 based on D4 less 30 days

 

I'm using the same table namely gbkmut

 

Thanks...tksnota...

 

tksnota_0-1736092341178.png

 

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @tksnota ,

 

Have a read through this to see how you can help us to help you get to the answer you're looking for quickly and correctly:

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/3251... 

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

4 REPLIES 4
BA_Pete
Super User
Super User

Hi @tksnota ,

 

Have a read through this to see how you can help us to help you get to the answer you're looking for quickly and correctly:

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/3251... 

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




tksnota
Post Patron
Post Patron

Thanks...if the user wants the reporting month like in 2019 will this code still work? Can you share the file if it's ok?

Please don't waste unpaid volunteer helpers time asking vague question.. Thank you.

 

Please accept this solution and then take proper time and effort to ask a new question with example data.

 

I am very keen to help but if you answer the wrong question and I give the correct answer then I expect you to accept the solution and not keep adding more vague narrative.

 

Look forward to helping if and when you comply, but not before.

 

 

speedramps
Community Champion
Community Champion

Click here to download example PBIX solution fro Onedrive
Click here 

 

Test it by changing data in Input and then look at output

 

Use 

Date.AddDays([#" Date in"], -31)

 

and then use a condition to only apply it to "Reporting mth"

 

speedramps_0-1736095503907.png


This works exactly as requested so please click [accept solution] and the thumbs up.

We are unpaid volunteers so please be generous and click to reward kudos for our time and effort. 
Thank you.

 

If you asked the wrong question then please still click [accept solution] and the thumbs up.
Then raise a new ticket, because it is unfair to not to reward kudos if you have asked vague or careless questions.


 

 

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors