Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
JimJim
Helper V
Helper V

Issue with ALL

Hi Guys,

I have the following measure:

 

Total > 2 days = 
VAR MinDate = MIN(DateMaster[Date])
RETURN
    COUNTROWS(FILTER('Service Appointment',
    'Service Appointment'[IsWIP]=1 && 
    'Service Appointment'[WIP Days] > 2 &&
    'Service Appointment'[Actual Start Time] > MinDate))

 

At the top of the page there is a single date slicer where a user selects a month.

If the slicer value is Sep 2020, I want the measure to calculate all rows where the Actual Start Date > 1 Sep 2020.

I attempted to add ALL to my measure, like so:

 

Total > 2 days = 
VAR MinDate = MIN(DateMaster[Date])
RETURN
    COUNTROWS(FILTER(ALL('Service Appointment'),
    'Service Appointment'[IsWIP]=1 && 
    'Service Appointment'[WIP Days] > 2 &&
    'Service Appointment'[Actual Start Time] > MinDate))

 

 

And although this returns the correct number of rows, when I add it to a matrix and it shows me the total number on each row, like so:

 

Screenshot 2020-11-05 154902.png

Note: I am not able to change the slicer to show only data after the selected date, as other visuals use the same slicer.

1 ACCEPTED SOLUTION
v-zhenbw-msft
Community Support
Community Support

Hi @JimJim ,

We can create a date table that has no relationship to meet your requirement.

 

1. Create a date table to be a slicer. You need to add month name column and month number column,

 

Date = CALENDAR("2020/8/1","2020/12/31")

 

issue1.jpg

 

2. Then we can create a measure like this,

 

Measure = 
var _select = SELECTEDVALUE('Date'[Month])
var _mindate = CALCULATE(MIN('Date'[Date]),FILTER('Date','Date'[Month]=_select))
return
COUNTROWS(
    FILTER(ALLSELECTED('Service Appointment'),'Service Appointment'[Start Date]>_mindate))

 

issue2.jpg

 

issue3.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

BTW, pbix as attached.

View solution in original post

5 REPLIES 5
v-zhenbw-msft
Community Support
Community Support

Hi @JimJim ,

We can create a date table that has no relationship to meet your requirement.

 

1. Create a date table to be a slicer. You need to add month name column and month number column,

 

Date = CALENDAR("2020/8/1","2020/12/31")

 

issue1.jpg

 

2. Then we can create a measure like this,

 

Measure = 
var _select = SELECTEDVALUE('Date'[Month])
var _mindate = CALCULATE(MIN('Date'[Date]),FILTER('Date','Date'[Month]=_select))
return
COUNTROWS(
    FILTER(ALLSELECTED('Service Appointment'),'Service Appointment'[Start Date]>_mindate))

 

issue2.jpg

 

issue3.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

BTW, pbix as attached.

Hi @v-zhenbw-msft ,

Thank you so much. This does the job 🙂

My old measure is now working also, turns out all I needed to do was remove the relationships from my DateMaster table. 

amitchandak
Super User
Super User

@JimJim , Either have an independent date filter and use first formula only .

Assuming Actual start time joined with Date master

 

Total > 2 days = 
VAR MinDate = MIN(DateMaster[Date])
RETURN
    COUNTROWS(FILTER(('Service Appointment'),
    'Service Appointment'[IsWIP]=1 && 
    'Service Appointment'[WIP Days] > 2 ,
    filter(all(DateMaster),DateMaster[Date]> MinDate))

@amitchandak 

I edited your DAX to this

Total > 2 days = 
VAR MinDate = MIN(DateMaster[Date])
RETURN
COUNTROWS(FILTER('Service Appointment',
'Service Appointment'[IsWIP]=1 && 
'Service Appointment'[WIP Days] > 2 &&
FILTER(ALL(DateMaster), DateMaster[Date] > MinDate )))

But getting error 'The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value'

I really appreciate your help with this.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.