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
davidiraz
New Member

need help

hi everyone. i need to develop a dashboard from a sql server and i have a little problem with the data order in one of the table.

 

1 - i have a table that contain a budget data. the table look like this:

BUDGET NAMEYEARJANFEBMARCHAPRIL
ABC12345620191000150020003000

 

and its continue to the next year...

2. i need to create a comparing dashboard between the budget and invoices table that look like this:

INOIVE NUMBERBUDGET NAMEINVOICE DATETOTAL $CURRENCY
123ABC12345601/01/20191500US DOLLAR
456ABC12345601/02/20192000US DOLLAR
789ABC12345601/03/20295000US DOLLAR

 

the desired result need to be that the user will be able to choose invoices dates, for example between 01/01/2019

and 31/03/2019

and i need to show somthing like:

INOIVE NUMBERBUDGET NAMEINVOICE DATETOTAL $BUDGETDELTACURRENCY
123ABC12345601/01/201915001000-500US DOLLAR
456ABC12345601/02/201920001500-500US DOLLAR
789ABC12345601/03/20295000200-4800US DOLLAR

 

how can i do it?

thanks.😀

1 ACCEPTED SOLUTION
vivran22
Community Champion
Community Champion

Hello @davidiraz 

 

Unpivot option is available in Power Query.

 

For your budget table, select Budget Name & Year > right click on the and Select Unpivot Other Columns

 

vivran22_2-1598758508531.png

 

 

Select Month & Year column and Merge with a space:

vivran22_3-1598758597646.png

 

Transform the Month column as Date:

vivran22_4-1598758651823.png

 

The output:

vivran22_5-1598758680251.png

 

Hope this helps!

 

Cheers!
Vivek

Blog: vivran.in/my-blog
Connect on LinkedIn
Follow on Twitter

 

 

View solution in original post

4 REPLIES 4
vivran22
Community Champion
Community Champion

Hello @davidiraz 

 

Unpivot option is available in Power Query.

 

For your budget table, select Budget Name & Year > right click on the and Select Unpivot Other Columns

 

vivran22_2-1598758508531.png

 

 

Select Month & Year column and Merge with a space:

vivran22_3-1598758597646.png

 

Transform the Month column as Date:

vivran22_4-1598758651823.png

 

The output:

vivran22_5-1598758680251.png

 

Hope this helps!

 

Cheers!
Vivek

Blog: vivran.in/my-blog
Connect on LinkedIn
Follow on Twitter

 

 

thanks you very much!!!

Greg_Deckler
Super User
Super User

@davidiraz Not sure that I entirely follow, but you will almost certainly want to start by unpivoting your month columns:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnRyNjQyNjE1U9JRMjIwtARShgYGBiDKFEwZQXjGICo2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"BUDGET NAME" = _t, YEAR = _t, JAN = _t, FEB = _t, MARCH = _t, APRIL = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"BUDGET NAME", type text}, {"YEAR", Int64.Type}, {"JAN", Int64.Type}, {"FEB", Int64.Type}, {"MARCH", Int64.Type}, {"APRIL", Int64.Type}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"BUDGET NAME", "YEAR"}, "Attribute", "Value")
in
    #"Unpivoted Columns"

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

where do i need to put this code?

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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