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.
Hi, I'm having a bit of trouble with DAX
Say if I have a dataset like this:
date,name
2020-05-04,Snake
2020-05-04,John
2020-05-04,John
2020-05-04,John
2020-05-04,James
2020-05-05,Liquid
2020-05-05,Snake
2020-05-06,Snake
2020-05-06,Snake
2020-05-06,Snake
I want to calculate how many times each names appears, then 'tally' those numbers. So in the above dataset, James & Liquid appeared in the dataset once, John appeared three times, and Snake appeared five times.
This is my desired output:
When using the solution from @ryan_mayu
Column = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[NAME]=EARLIER('Table'[NAME])))
If the dates get adjusted with a slicer, the values do not get updated (i.e. if a date slicer was set to 2020-05-05 onwards, 'Snake' would still show as appearing five times rather than four.
Thanks
-Edited to show problem with slicer.
@Kez_nz , refer if this can help
https://www.youtube.com/watch?v=9kp2Nu_LuXg
maybe you can create a column.
Column = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[NAME]=EARLIER('Table'[NAME])))
in your sample data, john appears 3 times, james and liquid appear once and snake appears 4 times
Proud to be a Super User!
I've went and tried it on my own data set and it worked until I changed the dates using a slicer.
I think I've found the problem:
If I add a row so that 'Snake' appears five times instead of four:
date,name
2020-05-04,Snake
2020-05-04,John
2020-05-04,John
2020-05-04,James
2020-05-04,John
2020-05-05,Snake
2020-05-05,Liquid
2020-05-06,Snake
2020-05-06,Snake
2020-05-06,Snake
If I shift the slicer to 2020-05-05, 'Snake' should now only be in there four times instead of five. However the graph still shows it as five:
Is there any way to fix this?
I think measures can't drag to x-aixs field. Let's see if anyone else can provide better solution for you.
Proud to be a Super User!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
95 | |
77 | |
65 | |
53 |
User | Count |
---|---|
144 | |
105 | |
102 | |
89 | |
63 |