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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
DanielPf
Regular Visitor

Creating custom table with multiple columns where the columns are not logically related

Hello,

I'm trying to put together a custom table with 12 columns, one column for each month. 

Each column should have a distinct list of account names, where a certain condition is met. I have  a base table let's call it Data that has three columns: Customer Name, Due Date, FY.

 

I want to display the distinct list of customer names in the first column (January), where the Month(Data[Due Date]) = 1,

I want to display the distinct list of customer names in the second column (February), where the Month(Data[Due Date]) = 2, and etc.

 

I am trying it with 

NewTable = CALCULATETABLE(VALUES('Data'[Customer Name]), Month('Data'[Due Date])=1 && ('Data'[FY] = "FY25" ) and it gives me one column with the distinct customer name values for January, but i don't know how to add the rest of the 11 columns for each month.
 
I'm quite new to this, so any help would be appreciated.
Thank you! 🙂



1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @DanielPf 

 

Please try this:
Here's the sample table:

Table:

vzhengdxumsft_0-1727241017186.png

In powerquery, remove the [Due Date] and [FY] columns:

vzhengdxumsft_1-1727241128605.png

Then click the fx and paste the following code in it:

 

Table.Group(#"Removed Columns", {"Month(Due Date) - not in data - only for example"}, {{"Count", each Table.AddIndexColumn(_, "Index", 1, 1, Int64.Type)}})

 

 vzhengdxumsft_3-1727241328720.png

Expand the Count column:

vzhengdxumsft_4-1727241397904.png

vzhengdxumsft_5-1727241445770.png

Finally, select the Month column and click Pivot Column in the Transform pane:

vzhengdxumsft_6-1727241573840.png

vzhengdxumsft_7-1727241628316.png

Remove the Index Column and Close&Apply.

The result is as follow:

vzhengdxumsft_10-1727241859091.png

 

 

Best Regards

Zhengdong Xu
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

7 REPLIES 7
Anonymous
Not applicable

Hi @DanielPf 

 

Please try this:
Here's the sample table:

Table:

vzhengdxumsft_0-1727241017186.png

In powerquery, remove the [Due Date] and [FY] columns:

vzhengdxumsft_1-1727241128605.png

Then click the fx and paste the following code in it:

 

Table.Group(#"Removed Columns", {"Month(Due Date) - not in data - only for example"}, {{"Count", each Table.AddIndexColumn(_, "Index", 1, 1, Int64.Type)}})

 

 vzhengdxumsft_3-1727241328720.png

Expand the Count column:

vzhengdxumsft_4-1727241397904.png

vzhengdxumsft_5-1727241445770.png

Finally, select the Month column and click Pivot Column in the Transform pane:

vzhengdxumsft_6-1727241573840.png

vzhengdxumsft_7-1727241628316.png

Remove the Index Column and Close&Apply.

The result is as follow:

vzhengdxumsft_10-1727241859091.png

 

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you vey much, this actually helped!
SachinNandanwar
Super User
Super User

you could probably create a custom table

 

NewTable =
ADDCOLUMNS( Data,
"Jan","Condition for month of Jan",
"Feb","Condition for month of Feb",

.

.

.
"Dec","Condition for month of Dec")

 

 



Regards,
Sachin
Check out my Blog

I was trying to use add columns like this:
NewTable = ADDCOLUMNS(Schedule, "January", Filter(DISTINCT(Customer Name), Month(Due Date) = 1), but this gave me an error : A table of multiple values was supplied where a single value was expected.

You should do something like this

"January", CALCULATE(VALUES('Data'[Customer Name]), MONTH('Data'[Due Date]) = 1 && 'Data'[FY] = "FY25")

 



Regards,
Sachin
Check out my Blog
HotChilli
Super User
Super User

Post some sample data (not a picture) and show your desired result please.

Can I ask what a row represents in this table? It sounds like each column is unrelated to other columns row-wise and it makes me wonder if what you are trying to do is a good idea.

Hello,

 

Input:

Customer NameDue DateMonth(Due Date) - not in data - only for exampleFY
Customer 101.01.2024JanuaryFY25
Customer 201.01.2024JanuaryFY25
Customer 301.01.2024JanuaryFY25
Customer 401.01.2024JanuaryFY25
Customer 501.01.2024JanuaryFY25
Customer 601.01.2024JanuaryFY25
Customer 701.07.2024JulyFY25
Customer 801.07.2024JulyFY25
Customer 901.07.2024JulyFY25
Customer 1001.10.2024OctFY25
Customer 101.10.2024OctFY25
Customer 201.12.2024DecFY25
Customer 301.12.2024DecFY25
Customer 401.12.2024DecFY25
Customer 501.09.2024SeptFY25
Customer 601.05.2024MayFY25
Customer 701.05.2024MayFY25
Customer 801.04.2024AprilFY25
Customer 901.04.2024AprilFY25
Customer 1001.12.2024DecemberFY25

 

Output:

JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptOctNovDec
Customer 1  Customer 8Customer 6 Customer 7 Customer 5Customer 10 Customer 2
Customer 2  Customer 9Customer 7 Customer 8  Customer 1 Customer 3
Customer 3     Customer 9    Customer 4
Customer 4          Customer 10
Customer 5           
Customer 6           
            
            
            
            
Distinct(Customer name) where Month(Due date) = 1          Distinct(Customer name) where Month(Due date) = 12

 

This output view is used to plan which customer needs attention each month.

 

Thank you 🙂

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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