Forum Discussion
DAX how split a string by delimiter into a list or array?
- 7 years ago
I think,,,,In that case we can use this MEASURE :smileywink:
Measure 3 = VAR mymeasure = SUBSTITUTE ( [Measure], ",", "|" ) VAR Mylen = LEN ( mymeasure ) VAR mytable = ADDCOLUMNS ( GENERATESERIES ( 1, mylen ), "mylist", VALUE ( PATHITEM ( mymeasure, [Value] ) ) ) VAR mylist = SELECTCOLUMNS ( mytable, "list", [mylist] ) RETURN CALCULATE ( COUNTROWS ( Table1 ), Table1[ID] IN mylist ) - 7 years ago
TomMartensiplaygod
Ohh. YesThis was exactly in my mind. I just forgot to replace LEN when I copy pasted myfirst formula.
Measure 3 = VAR mymeasure = SUBSTITUTE ( [Measure], ",", "|" ) VAR Mylen = PATHLENGTH ( mymeasure ) VAR mytable = ADDCOLUMNS ( GENERATESERIES ( 1, mylen ), "mylist", VALUE ( PATHITEM ( mymeasure, [Value] ) ) ) VAR mylist = SELECTCOLUMNS ( mytable, "list", [mylist] ) RETURN CALCULATE ( COUNTROWS ( Table1 ), Table1[ID] IN mylist )
Hey, I'm not totally sure what's going on your side,
maybe you might consider to create a pbix with some sample data, upload the pbix to onedrive or dropbox and share the link.
Nevertheless, this should work:
SalesSelectedDates2 = calculate([SumSales];Calendar[Date] in allselected(Calendar[Date]))
If it doesn't, you can debug this issue by just adding a measure like this:
_debug =
COUNTROWS(ALLSELECTED('Calendar'[Date]))
Add this measure to your table and make sure that the number meets your expectation, meaning the number of selected dates in your slicer.
Regards,
Tom
I have no idea what is going on but with my Power BI Desktop lately. I am using Feb-19 version.
DatePCS = countrows(allselected(Calendar[Date]))
Measure gives results 5 -as it should.
I have a table that I don't want to control with Date slicer. With date slicer I just want to control how my measure will be calculated.
Measure calculates total amount for every date in my table.
I have relationship between fact table and date table. I have also marked that as Date Table.
Here is pbix file: SelectedDates Calculation.pbix