Forum Discussion
Counting filtered data (AND filter)
- 6 years ago
Hi grggmrtn ,
this has to do with contex of the measure try the following:
Measure 2 = var temp_table = SUMMARIZE(Data; Data[PersonID];Data[WeekNr]; "@Value";[Measure]) return CALCULATE ( DISTINCTCOUNT ( Data[PersonID] ); FILTER(temp_table; [@Value] > 0) )Replace the Data[WeekNr] by the date column, should work as expected.
Hi grggmrtn ,
On the test I have made the result in the card is correct, as you can see below when I filter out the week the number of persons is changing accordingly. This model may not match with yours I used your sample data but instead of summing value i summed the week but the result is similar.
Are you abble to share a mockup file and expected result?
Hi again MFelix - unfortunatly I'm not able to share a mockup file since it's all GDPR protected, and creating a dummy would take way too long.
I can see that it SHOULD be working - I just can't figure out why I'm getting an Empty result. My data matches the test data, I don't have any other filters that are getting in the way... frustrating 😞
- MFelix6 years agoSuper User
Is your data only with the table you have show, or are there any other tables?
Be aware that measures are calculated based on context, meaning that any filters, slicers, visualizations settnigs, measure setup can influence the final result.
Do you have any other filtering applied on the report?
You refer that you have a slicer for the service person correct? how is that setup? maybe it's influencing the result of the second measure.
- grggmrtn6 years agoPost Patron
Hi MFelix
There is only one table.
The matrix looks like this ("CPR" = PersionID, "Indsats Navn" = Service, columns are year, quarter, week number - "Borger Navn" is the Person's name and "Leverandør" is the provider, but neither of those should have an influence on the results)
There are 5 slicers on the page, but I have disabled them all. There are no filters.
Which makes the (Empty) result in the card just all the more strange...
- MFelix6 years agoSuper User
Hi grggmrtn ,
this has to do with contex of the measure try the following:
Measure 2 = var temp_table = SUMMARIZE(Data; Data[PersonID];Data[WeekNr]; "@Value";[Measure]) return CALCULATE ( DISTINCTCOUNT ( Data[PersonID] ); FILTER(temp_table; [@Value] > 0) )Replace the Data[WeekNr] by the date column, should work as expected.