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,
that's my graph:
With the blue line (that's a simply distinct count) i need to sum the previous year to the current year.
So, it will become:
2014: 819
2015: 2412 + (819)
2016: 1702 + (2412 + 819)
....
How can i achieve this?
Thanks for help
Solved! Go to Solution.
@Anonymous
try a measure
Measure = CALCULATE(SUM('Table'[Codici]),FILTER(ALL('Table'),'Table'[Year]<=MAX('Table'[Year])))
If you have date dimension, you can try datesytd
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
Last YTD complete Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
2 Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-2,Year))
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Proud to be a Datanaut Connect on Linkedin
Really useful and concise YTD measures, thank you.
How would you go about this if "Sales[Sales Amount]" was a measure?
Hi @Anonymous
If "Codici" are exist in both 2019 and 2018 years it should be calculated as 1 or as 2?
Hi,
it should be count as 2!
Thanks
mid-question
these 2 columns are the same format: data type.
Why BI show me only one like a hierarchy?
@Anonymous
I think its because "Valido da" field is not clean, maybe it has an error values. check it in source and Power QUery editor. If everything is ok, set data type as date in Power query editor mode
@Anonymous
try a measure
Measure = CALCULATE(SUM('Table'[Codici]),FILTER(ALL('Table'),'Table'[Year]<=MAX('Table'[Year])))
I got the desired values with the above solution . Now when i am putting legends the graph is showing same values
Please if you have any solution on this
Am i missing something?
This is the problem
in the measure ALL is a problem
I will try with allexcept
Ok thanks it works with some correction in the filter, thanks!
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 |
---|---|
115 | |
100 | |
88 | |
68 | |
61 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |