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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
AmiraBedh
Super User
Super User

Create a calculated table with an input column and calculated column

I want to create a table in Power BI like below :

 

Product Year  Count

A           2020 100

B           2021  569

C           2021    99

 

The product is an input column which means I provide the name in the creation of the calculated table.

The Year is the group by column and the count is the a measure : counting the rows of the product A by Year


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @AmiraBedh ,

 

You could use SUMMARIZE() function.

https://docs.microsoft.com/en-us/dax/summarize-function-dax 

Since the product is an input column, you will need to filter the table for each product before summarize it. Ie create multiple summarized table based on products then union the summarized tables.

For example:

new_table = 
var product_a = SUMMARIZE(FILTER(Table,Conditon1),[Year]"product","A",COUNT([column]))
var product_b = SUMMARIZE(FILTER(Table,Conditon2),[Year]"product","B",COUNT([column]))
return
union(product_a,product_b)

If I misunderstood your meaning, please share some sample data and expected result.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

2 REPLIES 2
v-jayw-msft
Community Support
Community Support

Hi @AmiraBedh ,

 

You could use SUMMARIZE() function.

https://docs.microsoft.com/en-us/dax/summarize-function-dax 

Since the product is an input column, you will need to filter the table for each product before summarize it. Ie create multiple summarized table based on products then union the summarized tables.

For example:

new_table = 
var product_a = SUMMARIZE(FILTER(Table,Conditon1),[Year]"product","A",COUNT([column]))
var product_b = SUMMARIZE(FILTER(Table,Conditon2),[Year]"product","B",COUNT([column]))
return
union(product_a,product_b)

If I misunderstood your meaning, please share some sample data and expected result.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

@AmiraBedh , Last two are easy, they can be driven using group by power query or summarize of DAX.

 

How do you want calculate the product, that you need to tell to suggest solutions

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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