Problem with calculated column

Hi,

I created a calculated column for age of ticket as shown below.)
This is the DAX code used: Age of ticket(in days) = DATEDIFF( Fact_incident[Created DateTime], TODAY(), DAY

)

Result:
CreatedDate Age of ticket(in days)
13/05/2019 242
13/05/2019 241
14/05/2019 241
14/05/2019 240
15/05/2019 240
15/05/2019 239
16/05/2019 239
16/05/2019 238
17/05/2019 238
17/05/2019 237
18/05/2019 236
19/05/2019 235

When I tried to creat a chart from the above data, the Age of ticket(in days) is placed in the values but it changes to a count which gives me a wrong figure. I want the exact numbers above to be on the chart and not changing it to “count of Age of ticket(in days)”

Please what should I do? Need your help.

Thanks,
Liz…

If you have this in a calculated column, then you should create a measure over this column using for example SUM or AVERAGE before placing it into a visual.

This will solve your problem quite quickly I would say.

Always look to use measures. It’s the best way to start of any analysis.

Check out the below video as well to get an idea of how you could potentially do this differently as well, using measures for everything

Sam

Hi @Chukliz

Initial problem is when you are dragging the field “Age of ticket(in days)” into Chart it is defaulting to Count. if you are looking to change it to some other aggregation. Then you can do through by right clicking on value field and changing aggregation as shown below.

Regarding your second point, do you need to show all values like for 13/05/2019 you need to show both 242 or 241 or sum of them i.e 483. If need to show both then pls share if there are any other column present. Better if you can share your sample PBIX file

Thanks
Ankit Jain

Hi @Chukliz
For your second part, what I have done is created an Index Column for each Date. It will be dynamic based on number of rows for same date.

You can use that Index to show multiple values for same date in chart as below.
image

Attached the PBIX file:
Ankit_DNA_Age_Of_Ticket_Solution.pbix (23.6 KB)

I will be able to help further if you can provide exact requirements.

Also - In your case you can use both Calculated Column or Measure however as SAM mentioned best practice is to use Measures wherever possible.

Thanks
Ankit

1 Like

Hi @Chukliz, we’ve noticed that no response has been received from you since January 10, 2020. We just want to check if you still need further help with this post? In case there won’t be any activity on it in the next few days, we’ll be tagging this post as Solved. If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the check box. Thanks!