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
Anonymous
Not applicable

Show IDs when I click on bar chart

Hello,

 

I have a problem with a table in a power BI report.

 

To begin with, I have 3 tables:

 

1) Date table

2) Time Zone table (i create this for the order of graph)

Capture2.PNG

 

3) Main Table

 

The Main Table consists the information about the complaint ID (all unique value), the date of opening, the time zone (9-10, 10-11, etc.) opening, the date of closing, the time zone closing (9-10, 10-11, etc.) and others variables.

 

All i want to do is to plot in the same bar chart the opened (in) and closed (out) cases per time zone like the photo below:

 
 

 

Below you can see the data modeling:

1) Time Zone In (Active) with the Time Zone 

2) Time Zone Out (InActive) with the Time Zone 

 

3) Log_Date In (Active) with the Date Table 

4) Log_Date Out (InActive) with the Date Table

 

Untitled11.png

 

 

Also, I created a measure:

TimeZone_Out = CALCULATE(COUNTA('MainTable'[TimeZoneOut]), USERELATIONSHIP('MainTable'[TimeZoneOut],TimeZoneOrder[TimeZone]), USERELATIONSHIP('MainTable'[Log_Date_Out],'Date'[Date]))

 

My problem is that i want to see both which are the IDs In and the IDs Out when i click on the bar and not only the IDs In.

 

Untitled2.png

 

Thank in advance,

1 REPLY 1
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

According to your description, I created some data to show:

v-yangliu-msft_0-1606294309651.jpeg

 

Here are the steps you can follow:

1. Create measure.

In =
CALCULATE(COUNT('Main table'[the time zone open]),USERELATIONSHIP('Main table'[the time zone open],'Time Zone table'[Index]))
Out =
CALCULATE(COUNT('Main table'[ the time zone closin]),USERELATIONSHIP('Main table'[ the time zone closin],'Time Zone table'[Index]))
Flag = 
VAR _out=CALCULATE(MAX('Main table'[complaint ID]),USERELATIONSHIP('Main table'[ the time zone closin],'Time Zone table'[Index]))

var _in=CALCULATE(MAX('Main table'[complaint ID]),USERELATIONSHIP('Main table'[the time zone open],'Time Zone table'[Index]))

RETURN if(not(ISBLANK(_in))||not(ISBLANK(_out)),1,0)

2. Result.

v-yangliu-msft_1-1606294309655.jpeg

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

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

 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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