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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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/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 @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/3251... 

 

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.