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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
PbiCeo
Helper II
Helper II

How to control data amount on PBI desktop and service using PowerQuery parameter

Hello experts,

I want to create a report getting data from Azure SQL DB, but the data amount is quite large and PBI desktop is often frozen.
So I want to get data only for the past 2 months on PBI desktop using PowerQuery parameter (Date),
and then publish it to service and edit the parameter for all time.
Is it possible to do that?
If so, could you provide an example.
Thanks!
Vladi

1 ACCEPTED SOLUTION
rohit_singh
Solution Sage
Solution Sage

Hi @PbiCeo ,

You can try something like this :

1) Create a start date parameter called 'dateStart' by creating a new query and adding the following code:
Date.AddMonths(Date.From(DateTime.FixedLocalNow()),-2).

rohit_singh_0-1671030202319.png

This will give you a dynamic start date that is 2 months before current date.

2) In your Azure SQL query, you can then add a step to filter using dateStart as

rohit_singh_1-1671030393948.png

 

This should give you a filtered dataset with only 2 months worth of data.

Based on what you ask is, you can probably create another parameter named 'months' and use it as 
Date.AddMonths(Date.From(DateTime.FixedLocalNow()),months), keeping the initial value as -2 and then changing the value in the Paramters section in the dataset settings on the workspace, if possible.

rohit_singh_2-1671030755296.png

 

 

Kind regards,

Rohit


Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂

View solution in original post

1 REPLY 1
rohit_singh
Solution Sage
Solution Sage

Hi @PbiCeo ,

You can try something like this :

1) Create a start date parameter called 'dateStart' by creating a new query and adding the following code:
Date.AddMonths(Date.From(DateTime.FixedLocalNow()),-2).

rohit_singh_0-1671030202319.png

This will give you a dynamic start date that is 2 months before current date.

2) In your Azure SQL query, you can then add a step to filter using dateStart as

rohit_singh_1-1671030393948.png

 

This should give you a filtered dataset with only 2 months worth of data.

Based on what you ask is, you can probably create another parameter named 'months' and use it as 
Date.AddMonths(Date.From(DateTime.FixedLocalNow()),months), keeping the initial value as -2 and then changing the value in the Paramters section in the dataset settings on the workspace, if possible.

rohit_singh_2-1671030755296.png

 

 

Kind regards,

Rohit


Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

Top Solution Authors
Top Kudoed Authors