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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
TBStacey
Helper I
Helper I

Stacked bar graph question

I'm trying to create a bar graph that shows the "Earliest Confirmed Date" of a test on the X axis and the number of properties (PIN) confirmed via that test on the Y axis.

 

Since more than one test is done for a given property (PIN), a given property may have more than one confirmed date. In this bar graph, I only want to show the very first (earliest) confirmed date. I created a measure to do this as below:

 

TBStacey_2-1713038161510.png

 

The problem is, I can't get Power BI to add this measure into the X axis. I keep trying to move the measure (highlighted on right) to the X axis (highlighted on left). No luck.

TBStacey_1-1713037863032.jpeg

 

Any idea what I am doing wrong? Help!

1 ACCEPTED SOLUTION

The first part is simple - you can use the implicit measures

 

lbendlin_0-1713395572852.png

 

For the second part ( the chart ) you need a couple of things - for a proper implementation  you need a calendar table for the X axis, and then a measure for the mapping.  Or you can cheat and create a calculated table that materializes the prior result. This can be done by "borrowing"  the DAX code from the visual

 

lbendlin_1-1713395849839.png

and cleaning it up as

Table2 = SUMMARIZECOLUMNS(
			'Table'[PIN],
			'Table'[animal_state],
			"MinConfirmed_Date", CALCULATE(MIN('Table'[Confirmed Date]))
		)

 

Then you can render your column chart.

lbendlin_2-1713396068074.png

or in categorical axis

lbendlin_3-1713396131506.png

 

see attached

 

 

 

 

 

View solution in original post

5 REPLIES 5
lbendlin
Super User
Super User

In column charts the X axis must be fed by a column.  If you want it to be fed by a measure then you need to materialize that measure through pre-existing buckets (ie a disconnected table with all expected values.

I'm unsure how to do that, so I tried using Copilot to get language to use in Power query. But, I only get errors. This is the power query langauge I used:

 

= Table.AddColumn(#"Reordered Columns2", "Earliest Date Confirmed by PIN", each Table.Group(
    my query name here, {[animal_state]}, {{"Earliest Date Confirmed by PIN", each List.Min([Confirmed Date]), type date}}))

 

Any ideas on where I am going wrong?

This is something you need to do in DAX, not in Power Query.

 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Let's say the data looks like this. I want to know the earliest confirmed date for a given animal_state. I also want to know the earliest confirmed date for a given PIN, but I'll start with animal_state because I think that may be simpler.

 

PINanimal_stateConfirmed Date
ABCMN1/1/2024
ABCMN1/2/2024
AAAMN1/3/2024
AAAMN1/3/2024
AAAMN1/5/2024
AAAMN1/6/2024
AADMN1/7/2024
AADMN1/5/2024
AADMN1/5/2024
BADMI1/6/2024
BADMI1/7/2024
BADMI1/8/2024
BADMI1/15/2024
BADMI1/15/2024
BCDMI1/14/2024
BCDMI1/8/2024
CBAKS2/4/2024
CBAKS2/16/2024
CBAKS2/16/2024
CBAKS2/16/2024
CBAKS2/16/2024
CBAKS2/17/2024
CBAKS2/18/2024
CBAKS2/19/2024
CBAKS2/19/2024
CCDKS2/20/2024
CCDKS2/21/2024
CCDKS2/7/2024
CEDKS2/8/2024
CEDKS2/9/2024
CEDKS2/8/2024
CEDKS2/8/2024
CEDKS2/8/2024
CEDKS2/8/2024
CRDKS2/9/2024
CRDKS2/10/2024
CRDKS2/10/2024
CRDKS2/10/2024
CRDKS2/10/2024
DEDCA3/2/2024
DEDCA3/2/2024
DEDCA3/2/2024
DEDCA4/2/2024
DEDCA2/29/2024
DADCA2/29/2024
DADCA2/29/2024
DADCA2/29/2024
DADCA3/1/2024
DECCA3/2/2024
DTFCA3/2/2024
DTFCA3/2/2024
DTFCA3/2/2024
DTFCA3/2/2024
EEDTX2/4/2024
EEDTX2/4/2024
EEDTX2/4/2024
EEDTX4/3/2024
EEDTX4/4/2024
EEDTX4/5/2024
EEDTX4/6/2024
EADTX4/7/2024
EADTX4/7/2024
EATTX4/7/2024
EATTX4/7/2024
EATTX4/2/2024
EATTX3/15/2024
EATTX3/15/2024
ERDTX4/7/2024
ERDTX3/15/2024

 

I understand I need the data to be pivoted somehow like this (which I did manually) so I can see the earliest confirmed date per animal_state:

 

PINanimal_stateConfirmed Date
ABCMN1/1/2024
AAAMN1/3/2024
AADMN1/5/2024
BADMI1/6/2024
BCDMI1/8/2024
CBAKS2/4/2024
EEDTX2/4/2024
CCDKS2/7/2024
CEDKS2/8/2024
CRDKS2/9/2024
DADCA2/29/2024
DEDCA3/2/2024
DECCA3/2/2024
DTFCA3/2/2024
EATTX3/15/2024
ERDTX3/15/2024
EADTX4/7/2024

 

What I'd like as a final stacked bar graph is something like this:

TBStacey_0-1713224732488.png

Thanks.

The first part is simple - you can use the implicit measures

 

lbendlin_0-1713395572852.png

 

For the second part ( the chart ) you need a couple of things - for a proper implementation  you need a calendar table for the X axis, and then a measure for the mapping.  Or you can cheat and create a calculated table that materializes the prior result. This can be done by "borrowing"  the DAX code from the visual

 

lbendlin_1-1713395849839.png

and cleaning it up as

Table2 = SUMMARIZECOLUMNS(
			'Table'[PIN],
			'Table'[animal_state],
			"MinConfirmed_Date", CALCULATE(MIN('Table'[Confirmed Date]))
		)

 

Then you can render your column chart.

lbendlin_2-1713396068074.png

or in categorical axis

lbendlin_3-1713396131506.png

 

see attached

 

 

 

 

 

Helpful resources

Announcements
Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.