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
Guille
Frequent Visitor

Use Measure as chart legend in Direct Query Mode

Hi everybody,

have hit a roadblock and would appreciate your help on this. I am aware of limitations in DAX when using Direct Query mode. I have a table with the following columns among many more

Purchase Order

Date Received

Date Completed

Warehouse-ID

PO1

11/21/2017

11/24/2017

B

PO2

11/20/2017

11/20/2017

A

PO3

11/24/2017

11/28/2017

B

PO4

11/20/2017

11/22/2017

A

PO5

11/22/2017

11/24/2017

A

 

I need to calculate the number of days between these two dates, but only working days, excluding weekends and company holidays, which are not all federal holidays, but specific holidays in the year.

For warehouse A the Purchase order must be processed in one day maximum to meet the criteria. And for warehouse B they must be processed in two days maximum. In the sample above, PO1 meet criteria because 11/23/2017 was a holiday (thanksgiving) so it took only two days, PO3 meets criteria because there is a weekend between the two dates, PO4 took two days and doesn’t meet the criteria for warehouse A, but PO5 meets the criteria because of the holiday, so it only took one day to process.

Based on the number of days between these two dates and the warehouse-ID, I must count the total purchase orders that meet the criteria and the total that don’t meet the criteria, and represented in a bar chart like this:

Bars chart.PNG

I created measures to calculate the difference between dates with the help of a calendar table that includes the holidays, and created a measure that get values “Meet Criteria” and “Don’t Meet criteria” based on that difference, but can’t use that measure as legend in the chart. I could not use Calculated columns. Any help would be highly appreciated.

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @Guille,

 

It is not possible to add a measure as chart legend, as measure actually returns a single value. We can only add a column into legend section.

 

In your scenario, I would suggest you create two separately measures for “Meet Criteria” and “Don’t Meet criteria”. Add these two measures into Values section of the chart.

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yulgu-msft
Employee
Employee

Hi @Guille,

 

It is not possible to add a measure as chart legend, as measure actually returns a single value. We can only add a column into legend section.

 

In your scenario, I would suggest you create two separately measures for “Meet Criteria” and “Don’t Meet criteria”. Add these two measures into Values section of the chart.

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much. I was stuck in a similiar scenerio from past 2 days. After reading this, got it resolved.

Thank you so much Yuliana, I noted PBI does not allow to add the measure in the legend section, but was not clear why, now I understand. I will try your suggestion to see how this can be represented in a visual. Thanks again.

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.