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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Chris1300
Helper II
Helper II

Data changing when adding legend

I have a column chart that shows running total of distinct Login by week date.

 

I then add a legend to the same chart but the distinct count CHANGES (see total values above column). I am unable to understand why this is happening, and also how do I fix it?

 

The "Running Total" is a measure that i wrote, please see screenshot. Please see screenshot. Cant post pbix file due to limitations.

 

Any feedback would be appreciated.

 

2022-07-27.png

 

 

7 REPLIES 7
lbendlin
Super User
Super User

That's a good one. What the measure does is show the cumulative total for each department.  That is clearly different from the cumulative total across all departments.

So the measure works correctly, but it doesn't give you the result you expected.  The question is if your expected result actually makes sense?

lbendlin
Super User
Super User

your running total calculation is not correct. You need to move the MAX() part outside of the CALCULATE() part (by using a variable). Pseudo code: 

Running Total = 
var m = MAX([Date])
return calculate(distinctcount([NewLogin]),[Date]<=m)

 

Did not work. the result is the same even with MAX() outside the calculate or inside.

Please provide sanitized sample data that fully covers your issue.

I have given an example dataset shown below.

 

My goal is to make 2 charts. The first Chart would be a column chart. X-axis would have the [week_num_date] and the Y-axis would have the Cumulative Total (aka Running Total of distinct login), which I created a measure. 

 

 

Running Total = 
CALCULATE (
    DISTINCTCOUNT('Table2'[NewLogin]),
    'Table2'[Week_Num_Date]<= MAX('Table2'[Week_Num_Date]))

 

 

The next chart would also be a similar column chart, but to show a legend of [EMP_DEPT_NM]. When I add this legend the overall distinct count changes and unable to show similar values as Chart 1. 

 

2022-07-29.png

 

 

 

 

 

 

 

NewLoginEMP_DEPT_NMWeek_Num_Date
B4714Branch Operations5/22/21
B7788Branch Operations5/22/21
C3553Lending5/22/21
C1254Lending5/22/21
A9948President/CEO''s Office5/29/21
B3683President/CEO''s Office5/29/21
C3553Lending5/29/21
C2222Finance6/5/21
C1296Finance6/5/21
B6326Information Services6/5/21
A9865Branch Operations6/5/21
B7788Branch Operations6/5/21

 

I have been experiencing the exact same issue. 

 

Here is the measure: 

Number of Issues during the Period = 
VAR EndDatePerVisual = MAX('Date'[Date])
VAR StartDatePerVisual = MIN('Date'[Date])
VAR RESULT = 
    CALCULATE(
        [Number of Issues],
        REMOVEFILTERS('Date'),
        Issues[Start Date] <= EndDatePerVisual,
        Issues[Due Date] > StartDatePerVisual || ISBLANK(Issues[Due Date])
    )
RETURN RESULT

It's really easy to visualize this problem when using a "Line and clustered column chart:

wesleygeddes555_0-1682020627178.png

The configuration of this visual is here: 

wesleygeddes555_1-1682020649506.png

 

The measure being stored in "Column y-axis" is the SAME measure in the "Line y-axis." But yet the total value for the line and the columns are different. 

 

Were you able to figure out the difference? I'm experiencing a similar issue.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.