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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
srlabhe
Super User
Super User

Dax for calculating count of Login on Bar Chart

Hi PBI Gurus,

I have below table which is sample data of what I actually have

ID Area login DynamicMeasure
1 East 111ABC Assigned
1 East 123PQR Unassigned
2 East 111ABC Assigned
2 West 111ABC Assigned
3 West 111ABC Assigned
4 West 123PQR Unassigned
5 West 456ABC Unassigned

In Above table the first column ID is driver of data. If we take off first column the DynamicMeasure shows blank.

Also we cant use the measure in Graph's Legend. We have slicer on Area, DynamicMeasure (I build slicer on measure creating separate data table and using a flag to compare data table values and DynamicMeasure to select)

Now, when I am trying to put it on Graph it fails ,I need to put a distinct count of logins for each Area where DynamicMeasure in legend in clustred bar chart.

Any suggestion ofr DAX creation please ?

1 ACCEPTED SOLUTION
v-dineshya
Community Support
Community Support

Hi @srlabhe ,

Thank you for reaching out to the Microsoft Community Forum.

 

As you mentioned in your query, you can't able to use measure in Graph's Legend. And you need to put a distinct count of logins for each Area where DynamicMeasurein legend in clustred bar chart.

 

You can't use measures in clustred bar chart legend, Instead of measure create calculated column. I have created calculated column "DynamicStatus" and placed in legend field.  And i have created "Login Distinct Count" measure to show "distinct count of logins for each Area"  in clustred bar chart. Please refer below output snaps and attached pbix file.

 

vdineshya_0-1770272383798.png

 

vdineshya_1-1770272568112.png

 

I hope this information helps. Please do let us know if you have any further queries.

 

Regards,

Dinesh

 

View solution in original post

5 REPLIES 5
v-dineshya
Community Support
Community Support

Hi @srlabhe ,

Thank you for reaching out to the Microsoft Community Forum.

 

As you mentioned in your query, you can't able to use measure in Graph's Legend. And you need to put a distinct count of logins for each Area where DynamicMeasurein legend in clustred bar chart.

 

You can't use measures in clustred bar chart legend, Instead of measure create calculated column. I have created calculated column "DynamicStatus" and placed in legend field.  And i have created "Login Distinct Count" measure to show "distinct count of logins for each Area"  in clustred bar chart. Please refer below output snaps and attached pbix file.

 

vdineshya_0-1770272383798.png

 

vdineshya_1-1770272568112.png

 

I hope this information helps. Please do let us know if you have any further queries.

 

Regards,

Dinesh

 

Hi @srlabhe ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.

 

Regards,

Dinesh

Hi @srlabhe ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.

 

Regards,

Dinesh

GeraldGEmerick
Super User
Super User

@srlabhe You typically create a table without any relationships that has data corresponding to the possible measure values. So in your case, you would have a single column table with 2 rows for Assigned and Unassigned. You can then use those in the legend of your visuals. You can then create a measure similar to the following:

Distinct Count = 
VAR _Value = SELECTEDVALUE( 'Measure Value Table'[Value] ) //This is your non-connected table
VAR _Table = ADDCOLUMNS( 'Table', "MeasureValue", [DynamicMeasure] )
VAR _Return = COUNTROWS( DISTINCT( SELECTCOLUMNS( FILTER( _Table, [MeasureValue] = _Value ), "ID", [ID] ) ) )
RETURN _Return
      

This is not working as expected as Even Area is text based DAX measure here , so need to have the row context maintained even I take ID column off the Login column values should not change

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

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