Forum Discussion
Two Date in Measure
I've a table with a columns date and other the price. I need create two measure, one measure return the SUM from slicer selected with column date and the other measure the SUM from other slicer with same column date. How can i do this?
I'm learning DAX. What I did was create two table with same Date: Date_1 and Date_2. After i created a relationship from DATE_1 to main table, and from DATE_2 to main table. Disable the relationships and i used USERELATIONSHIP.
Measures created:Value 1: CALCULATE([measure], USERELATIONSHIP(DATE_1[DATE], GOODS[UPDATE]) ) Value 2: CALCULATE([measure], USERELATIONSHIP(DATE_2[DATE], GOODS[UPDATE]) )
3 Replies
- mustafaasirogluMicrosoft EmployeeIf your two measures will be used in separate visuals, only one measure and one date column seems enough for your scenario. All needed is using edit interaction to specify which slicer will affect which visual.
If you need both measure to be in same visual, then easiest approach can be creating a second date table clone using dax, and making each measure formulas something like =Calculate(sum amount, filter (datatable, date = SelectedValue(date1[date])) so different measures will use different date filters. - mwegenerMost Valuable Professional
You are thinking on something like this?
- PietroFariasResolver II
I'm learning DAX. What I did was create two table with same Date: Date_1 and Date_2. After i created a relationship from DATE_1 to main table, and from DATE_2 to main table. Disable the relationships and i used USERELATIONSHIP.
Measures created:Value 1: CALCULATE([measure], USERELATIONSHIP(DATE_1[DATE], GOODS[UPDATE]) ) Value 2: CALCULATE([measure], USERELATIONSHIP(DATE_2[DATE], GOODS[UPDATE]) )