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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
mcantos
Frequent Visitor

Create a new table from columns in another table usign calculations

Hello!


First of all, I'm starting to work on Power Query. I need some guidelines because I tried to figure them out and I just couldn't. 

I have this table, well, it is a big table, but I only need these two fields that belong to the same table "Opportunity":

mcantos_0-1708095981216.png

 

 

And from that table, I need to get something like this:

 

mcantos_1-1708095981218.png

 

 

I don't know what is the best way to do it whether is by creating a new table or measures.

Thank you so much in advance.

2 REPLIES 2
Vijay_A_Verma
Super User
Super User

See a sample code below (last 2 steps are for interest to you. Basically add a Custom colum with value of 1 and then pivot it.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTIyMDJSitWJVnJC5qDIOEM4xgQ4jlg4JkqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Current stage" = _t, Year2 = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Custom", each 1),
    #"Pivoted Column" = Table.Pivot(#"Added Custom", List.Distinct(#"Added Custom"[Year2]), "Year2", "Custom", (x)=>List.Min({1,List.Count(x)}))
in
    #"Pivoted Column"

 

Hi @Vijay_A_Verma ,

Thank you for your quick reply. 

I couldn't find a way to do what you explained. I tried to mimic the syntaxis to create the columns but the editor says it is not correct and I think is because I am using a DirectQuery connection and I pretend to transform the data in the Model view. 

 

mcantos_1-1708378280430.png

 

Does that make any sense to you? Sorry, I'm really new to this. 

Thank you!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors