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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

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 @Anonymous ,

 

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/3251928 

 

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 @Anonymous ,

 

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/3251928 

 

Pete



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

Proud to be a Datanaut!




Anonymous
Not applicable

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

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.