cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Dynamically computing months column

I have added Pivot steps in my table  and this made my months column (Jan to Jun) appear. The next step am the below query to replace column values using 

Table.ReplaceValue(#"Pivoted Column",null,0,Replacer.ReplaceValue,{"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"})

 

The problem here is since I dont have no data from Jul to Dec, the query fails to execute. How do I dynamically make the list of month's appear in the above formula ?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User II
Super User II

Re: Dynamically computing months column

Hi @smathew8,

change your pivot function that it pivots not only distict values in your table but more - see screenshot.

Sample data:

Capture.PNG

Your pivot looks similar to mine, right? The List.Distinct ... gives you distict values of the column Month. But you want more.

Capture2.PNG

Therefore you define all the 12 months by yourself. There will be nulls for all months where no values exist.

Capture3.PNG

View solution in original post

1 REPLY 1
Super User II
Super User II

Re: Dynamically computing months column

Hi @smathew8,

change your pivot function that it pivots not only distict values in your table but more - see screenshot.

Sample data:

Capture.PNG

Your pivot looks similar to mine, right? The List.Distinct ... gives you distict values of the column Month. But you want more.

Capture2.PNG

Therefore you define all the 12 months by yourself. There will be nulls for all months where no values exist.

Capture3.PNG

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Upcoming Events

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors