Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi there,
I have a table of data with the following columns:
CREATED_ON |
Locations_ID |
Offer_ID |
DELETED |
LAST_MODIFIED |
The scenario is that locations can list offers:
- When a new offer is listed at a location, a new entry is made in the table
- When an offer is deleted, the deleted column is set to 1, Last_modified set to the current date/time and the row will never change again.
What I would like to do is show on a bar chart / line chart how many 'live' offers there are at any point in time. I think this could be achieved using DAX. Any help would be greatly appreciated.
Many thanks,
In this scenario, I suggest you combine the start date and end date onto same row for each individual offer. Then you can calculate "active" offers within date range:
Active Offers:=CALCULATE(COUNTROWS(DimOffer), FILTER(DimOffer, ([StartDate] <= LASTDATE(DimDate[Datekey]) && [EndDate>= FIRSTDATE(DimDate[Datekey]))))
Please also refer to articles below:
Counting “Active” Rows in a Time Period: Guest Post from Chris Campbell
PowerPivot Use Case: Getting the active products between a date range using DAX
Regards,
Events in progress!
Have a look at this paper, page 16 onwards, for some ideas on DAX code. The paper contains DAX queries but the logic is basically the same for a measure.
http://www.sqlbi.com/wp-content/uploads/DAX-Query-Plans.pdf
This has come up several times on this forum and the Mr Excel Power BI forum if you search for 'events in progress'.
Questions to think about in your situation that would affect the DAX code:
Yes definitely do-able. It can be done at the visual level using a filter applied to the Delete field. Or it could be done at the table level in creating a new table of just Live records....
If you expect to include visuals including Delete records - such as counts or comparisons of Deletes to Live; then working with the whole table and tactically applying a visual filter makes sense.
On the other hand if all you ever will do is report on Live records - and Deletes are just clutter - then getting the new table upfront can be easier.....
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
143 | |
85 | |
66 | |
51 | |
45 |
User | Count |
---|---|
216 | |
89 | |
82 | |
66 | |
57 |