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 have a slicer which has CampaignYear values and the data table(CustTrans) which has CampaignYear,CustomerId, TransDate and other data fields
I have selected 2021 in the slicer.
I am returning CustomerCount YTD
TotalCustomers = CALCULATE(COUNT(CustomerId), FILTER(TransDate <= DATE(YEAR(TODAY()), MONTH(TODAY()), DAY(TODAY())))
This is working fine.
Now, I need to find the LY count for the same period.
TotalCustomers LY =
var PrevCampaignYear = SELECTEDVALUE(CampignYear)-1
RETURN CALCULATE(DISTINCTCOUNT(CustomerUid), FILTER(ALL(CustTRans) CustTRans(CampaignYear = PrevCampaignYear) && CustTrans(TransDate) <= DATE(YEAR(TODAY())-1, MONTH(TODAY()), DAY(TODAY()))))
I tried to display in the table visual with CampaignYear, TotalCustomers, TotalCustomers LY
Current year total is correct but LY total displaying the value for all CampaignYears even I have selected 2021 in the slicer?
It is killing me. I have 1 to Many relationship between these two tables
Please advise
Thanks
I have monthly data for economic variables and I want to see their evolution by month, but I do not know how to create that measure
Hi @rajanimaddala ,
Please refer to similar threads
https://community.powerbi.com/t5/Desktop/YTD-last-year-DAX/td-p/108482
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@rajanimaddala , refer this formula to get last year data
example
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"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year 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))
refer this too:Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
Can you please share some dummy data and power bi model so that we can try..
Regards,
sanalytics
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 |
---|---|
114 | |
100 | |
83 | |
70 | |
61 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |