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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
pcowman1
Helper I
Helper I

Using a Single Date as a Parameter for Aging AP/AR

I'm trying to use a Parameter to change the date that I age AR and AP by. Usually I would just use Today() but instead I want to use the parameter AgeByDate. However, when I update the parameter in Desktop or in the service it doesn't change any of the numbers.

 

In M Query I created a column with the following:

 

#"Add Age" = Table.AddColumn(#"Filtered Rows", "Doc Age", each Duration.Days(@AgeByDate - [Document_Date]))

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @pcowman1 

Create what-if parameter in Power BI,

Then create a measure

age = DATEDIFF(MAX([birthdate]),DATE([year Value],[month Value],[day Value]),YEAR)

Capture12.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

8 REPLIES 8

Hi @pcowman1,

 

did you solve your problem?


If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


@mwegenerI haven't had a chance to try yet. Maybe this week. 

Anonymous
Not applicable

Create one dummy Date table and create one after date slicer which allow user selection input.

 

Then Create below Column for age calculation.

int(YEARFRAC(Table[Date_Of_Birth],MIN('Date'[CALENDAR_DATE])))
v-juanli-msft
Community Support
Community Support

Hi @pcowman1 

Is this problem sloved? 
If it is sloved, could you kindly accept it as a solution to close this case?
If not, please let me know.
 
Best Regards
Maggie
v-juanli-msft
Community Support
Community Support

Hi @pcowman1 

Create what-if parameter in Power BI,

Then create a measure

age = DATEDIFF(MAX([birthdate]),DATE([year Value],[month Value],[day Value]),YEAR)

Capture12.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.

Hi @pcowman1 ,


did you do a data refresh?

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


I don't want to do a data refresh every time the date changes.

Hi @pcowman1 ,

 

Unfortunately, this is part of a change in Power Query.

At runtime, it only works with DAX and a what-if parameter.

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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