March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Report Date | Cat |
17/03/20 | Correct |
17/03/20 | Wrong |
17/03/20 | Deduct |
17/03/20 | Missing |
06/03/20 | Deduct |
06/03/20 | Correct |
06/03/20 | Wrong |
25/09/19 | Correct |
15/09/19 | Missing |
Good eveneing/afternoon/morning all,
Based on the above table, i would like to create two measures to count the 'Cat' for the current (17/03/20) & previous (06/03/20) 'Report Date' where 'Cat' does note equal "Correct".
The data within the table above will be updated frequently and new 'Report Dates' will be added. The measures will need
to dynamically understand what is the date of 'Current Report Date' & 'Last Report Date'.
Based on the above table the two measures will provide the following result:-
Current report = 3
Last Report = 2
Ultimately i want to deduct the difference of the 'Current Report' and 'last report' and add that value to a card.
Any help will be overwhelmingly appreciated
Solved! Go to Solution.
These expressions will generate the values you are looking for in your card visuals.
If this works for you, please mark it as solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
@Anonymous , witch help from a date calendar
Last Day Non Continous = CALCULATE(sum('order'[Qty]),filter(all('Date'),'Date'[Date] =MAXX(FILTER(all('Date'),'Date'[Date]<max('Date'[Date])),Table['Date'])))
Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Day))
This Day = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])))
Last Day = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])-1))
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/
See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184
Appreciate your Kudos.
@Anonymous solving a problem is one thing, following best practice and having a scalable solution is another thing. Always always when you are working with dates, have a date dimension in your model, even if you are not working with dates, still have one, I haven't seen any report which is not have anything to do with dates. My 2 cents and good luck.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
These expressions will generate the values you are looking for in your card visuals.
If this works for you, please mark it as solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hi mahoneypat!
Many many thanks for this. I am currently unable to try this for a few days.
I will leave some feedback as soon as i can.
Do you know if this method will work with a slicer?
As an example, I have another column for 'Item' (This contains one of either, item1, item2, item3, item4, item5, item6). Would i be able to use a slicer to display the result of 'Last Report Date' for each individual item in a Card?
Thanks again for all of your help
Yes. Those measures should work with slicers and in a table visual. Please let me know if not.
If this works for you, please mark it as solution. Kudos are appreciated too.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
@Anonymous As a best practice, add date dimension in your model and use it for and time intelligence calculations. Once the date dimension is added, mark it as a date table on table tools.
https://perytus.com/2020/05/22/create-a-basic-date-table-in-your-data-model-for-time-intelligence-calculations/
Once you have a date dimension in your model, you can take advantage of all time intelligent functon and all these period based calculations will be super easy.
Previous Day = CALCULATE ( COUNTROWS ( Table ), DATEADD ( DateTable[Date], -1, DAY ), <<other filter condition>> )
Previous Day = CALCULATE ( COUNTROWS ( Table ), PREVIOUSDAY ( DateTable[Date]), <<other filter condition>> )
Let's follow the best practice for a more scalable solution and take advantage of Time Intelligence function. Why not to make calculations complicated?
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hey parry2k & amitchandak,
Many thanks for your suggestions. I think adding a date dimension is probably the desired long term solution.
I will hopefully get some time to try it out later this week and give you some feedback. (after i have worked out a quick short term solution).
Many thanks again for taking the time to help me out
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |