cancel
Showing results for
Did you mean:
Helper IV

## DAX with Filters on dates for the month

Hello

I am trying to calculate the total for the month based on the below criteria and need some help on how to use the filter

I have 2 fact tables. 1 with the Purchases by the date and another for the receipts in the dock which are in the process of being received. Second table is more of a snapshot. This means 1 PO qty will be part of the snapshots taken on multiple dates.

Based on the selected date, i am trying to total the snapshot table for the totals for the entire month. In the below scenario, if the date selected is 17th Dec, total should look at the snapshot taken on 17th Dec and total quantity for the month. So the expected total will be 75 and exclude Jan quantity

1 ACCEPTED SOLUTION
Super User

Hi,

In the Purchase snapshot table, i created a calculated column formula

Test = FORMAT(PurchaseSnapshot[Date],"mmyy")=FORMAT(PurchaseSnapshot[Snapshot Date],"mmyy")

Your measure should not be:

On Dock Total = Calculate(sum(PurchaseSnapshot[Quantity]),PurchaseSnapshot[Test]=TRUE())

Hope this helps.

Regards,
Ashish Mathur
http://www.ashishmathur.com
4 REPLIES 4
Super User

Hi,

In the Purchase snapshot table, i created a calculated column formula

Test = FORMAT(PurchaseSnapshot[Date],"mmyy")=FORMAT(PurchaseSnapshot[Snapshot Date],"mmyy")

Your measure should not be:

On Dock Total = Calculate(sum(PurchaseSnapshot[Quantity]),PurchaseSnapshot[Test]=TRUE())

Hope this helps.

Regards,
Ashish Mathur
http://www.ashishmathur.com
Super User

@Pbi07 , Create an independent date table and then try a measure like

//Date1 is independent Date table,
new measure =
var _max = maxx(allselected(Date1),Date1[Date])

return

calculate(sum(Table[Quantity]), filter(Table, Table[Snapshot_date] =_max && eomonth(Table[Date],0) = eomonth(_max,0) ) )

Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!
Helper IV

Tried the measure. But did not work.  Calendar is amrked as a date table and relationship set between Date &  the date in Snapshot table.

new measure =
var _max = maxx(allselected('Calendar'),Calendar[Date])
return
calculate(sum(PurchaseSnapshot[Quantity]), filter(PurchaseSnapshot, PurchaseSnapshot[Date] =_max && eomonth(PurchaseSnapshot[Date],0) = eomonth(_max,0) ) )

Helper IV

The relation is between calendar [date] & PurchaseSnapshot[SnapshotDate] and the total filtering is on the PurchaseSnapshot[Date] for the beginning to end of the month for selected date.

Announcements