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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
smathew8
Frequent Visitor

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
Nolock
Resident Rockstar
Resident Rockstar

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
Nolock
Resident Rockstar
Resident Rockstar

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

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.