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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
slauer12
Frequent Visitor

Calculated columns as axis & value

I have a bunch of calculated dax columns that I want to show as a visual. If I use a normal bar chart I get the following image where because I do not have any fields in the axis field. The titles of each of the calculated columns are what I want the x-axis to be similar to how it is in the funnel chart below. 

 

Barchart.JPG

The funnel chart only requires the value field to be filled in and it creates the following image which is kind of what I want but it needs to be vertical similar to the last image. 

 

Barchart2.JPG

 

This final image is what I want to achieve with my calculated columns but so far I have had no luck in figuring this out. This visual was created using a different file which is irrelevant to the project I am working on now.  I believe that if I could unpivot the calculated columns then it would create the graph I am looking for but I can't figure out how to unpivot columns that are created in dax. Is there a way to unpivot dax columns or a visual on the marketplace to accomplish what I am trying to do? Or would I need to create my own custom visual to accomplish this?  Other ideas/thoughts?

 

Barchart3.JPG

 

 

Sample data file

 

1 ACCEPTED SOLUTION
slauer12
Frequent Visitor

I ended up coming up with a solution for this. It doesn't maintain relationships but it works. 

 

Totals Table = 
UNION(
    SUMMARIZE(Sheet4,"Cost",SUM(Sheet4[January 2020]),"Month","January 2020"),
    SUMMARIZE(Sheet4, "Cost", SUM(Sheet4[February 2020]), "Month", "February 2020"),
    SUMMARIZE(Sheet4,"Cost",SUM(Sheet4[March 2020]),"Month","March 2020"),
    SUMMARIZE(Sheet4, "Cost", SUM(Sheet4[April 2020]), "Month", "April 2020"),
    SUMMARIZE(Sheet4,"Cost",SUM(Sheet4[May 2020]),"Month","May 2020"),
    SUMMARIZE(Sheet4, "Cost", SUM(Sheet4[June 2020]), "Month", "June 2020"),
    SUMMARIZE(Sheet4,"Cost",SUM(Sheet4[July 2020]),"Month","July 2020"),
    SUMMARIZE(Sheet4, "Cost", SUM(Sheet4[August 2020]), "Month", "August 2020"),
    SUMMARIZE(Sheet4,"Cost",SUM(Sheet4[September 2020]),"Month","September 2020"),
    SUMMARIZE(Sheet4, "Cost", SUM(Sheet4[October 2020]), "Month", "October 2020"),
    SUMMARIZE(Sheet4,"Cost",SUM(Sheet4[November 2020]),"Month","November 2020"),
    SUMMARIZE(Sheet4, "Cost", SUM(Sheet4[December 2020]), "Month", "December 2020"))

View solution in original post

8 REPLIES 8
slauer12
Frequent Visitor

I ended up coming up with a solution for this. It doesn't maintain relationships but it works. 

 

Totals Table = 
UNION(
    SUMMARIZE(Sheet4,"Cost",SUM(Sheet4[January 2020]),"Month","January 2020"),
    SUMMARIZE(Sheet4, "Cost", SUM(Sheet4[February 2020]), "Month", "February 2020"),
    SUMMARIZE(Sheet4,"Cost",SUM(Sheet4[March 2020]),"Month","March 2020"),
    SUMMARIZE(Sheet4, "Cost", SUM(Sheet4[April 2020]), "Month", "April 2020"),
    SUMMARIZE(Sheet4,"Cost",SUM(Sheet4[May 2020]),"Month","May 2020"),
    SUMMARIZE(Sheet4, "Cost", SUM(Sheet4[June 2020]), "Month", "June 2020"),
    SUMMARIZE(Sheet4,"Cost",SUM(Sheet4[July 2020]),"Month","July 2020"),
    SUMMARIZE(Sheet4, "Cost", SUM(Sheet4[August 2020]), "Month", "August 2020"),
    SUMMARIZE(Sheet4,"Cost",SUM(Sheet4[September 2020]),"Month","September 2020"),
    SUMMARIZE(Sheet4, "Cost", SUM(Sheet4[October 2020]), "Month", "October 2020"),
    SUMMARIZE(Sheet4,"Cost",SUM(Sheet4[November 2020]),"Month","November 2020"),
    SUMMARIZE(Sheet4, "Cost", SUM(Sheet4[December 2020]), "Month", "December 2020"))
dax
Community Support
Community Support

Hi @slauer12 , 

It seems that you want to unpivot table and create cumulative value in chart, right? If so, you could refer to my sample for details.

I unpivot columns and create a month column, the create a measure to cumulative value.

Best Regards,
Zoe Zhi

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

slauer12
Frequent Visitor

Thanks for your reply @dax.

 

Yes that is what I am trying to accomplish except I have an ever growing list of projects and can't manually enter data to manipulate. I could be wrong but that's what it looks like what you did to take the data from the calculated columns to power query. As some of these projects have not yet started and are getting updated all the time it would be very tedious to update the static information as well as change the dollar amounts each time something gets updated. For a frame of reference, I have roughly 400 projects that I am trying to do this for and the list is growing weekly and to be able to keep up with it would be tough. 

dax
Community Support
Community Support

Hi  @slauer12 , 

In  my sample, there is no calculated column in it, I use M code to create new column, so you don't need to insert data manually, you could copy the M code from Advanced Editor , and use this in your report.

Best Regards,
Zoe Zhi

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

slauer12
Frequent Visitor

I copied and pasted your code with a few edits to call the columns I need and I get list errors. How does it know which source to pull from? Is this because the long file name isn't pointing to the correct sheet?

slauer12
Frequent Visitor

Oh I see. I overlooked this. Do you know of a tutorial where I can learn how to do this? I don't completely understand what the source line means and how to replicate it for my use. I understand the rest of the code but not sure where the json document is and how to figure out the long line for file. 

parry2k
Super User
Super User

@slauer12 share some data. Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.