Forum Discussion

TBStacey's avatar
TBStacey
Helper I
2 years ago
Solved

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:

 

 

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.

 

Any idea what I am doing wrong? Help!

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

     

     

    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

     

    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.

    or in categorical axis

     

    see attached

     

     

     

     

     

5 Replies

  • 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.