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.
Hi,
I want to create a measure to show quarterly count of records with multiple filters. The data table is like below,
For this example, the result (record count) should be = 4
I tried below measure with DistinctCount
CustomMeasure = CALCULATE(DISTINCTCOUNT('VW_Water'[CC_MASTER__ID]), 'VW_Water'[Fiscal_Quarter], filter('VW_Water','VW_Water'[CC_MAST_SUBTYPE]= "E*LEAK" && 'VW_Water'[EarlyClosure]= "Double up" && 'VW_Water'[Activity]= "Complete"))
The output should be like this.
Appreciate your help.
thanks
Solved! Go to Solution.
The syntax for CALCULATE is CALCULATE([expression], filter, filter, filter...). You are trying to add multiple filters in the same FILTER statement by using &&. Simply add more FILTER statements and it should work.
CustomMeasure = CALCULATE(DISTINCTCOUNT('VW_Water'[CC_MASTER__ID]), FILTER('VW_Water','VW_Water'[CC_MAST_SUBTYPE]= "E*LEAK"), FILTER('VW_Water','VW_Water'[EarlyClosure]= "Double up"), FILTER('VW_Water','VW_Water'[Activity]= "Complete"))
Hope this helps!
Hi,
The easiest would be to just apply filter or create slicers and then select. If you are OK with this approach, then this measure will work
=DISTINCTCOUNT('VW_Water'[CC_MASTER__ID])
If you do not wish to use slicers/filters, then write this measure
=CALCULATE(DISTINCTCOUNT('VW_Water'[CC_MASTER__ID]), 'VW_Water'[Fiscal_Quarter]="Q1",'VW_Water'[CC_MAST_SUBTYPE]= "E*LEAK",'VW_Water'[EarlyClosure]= "Double up",'VW_Water'[Activity]= "Complete")
Hope this helps.
The syntax for CALCULATE is CALCULATE([expression], filter, filter, filter...). You are trying to add multiple filters in the same FILTER statement by using &&. Simply add more FILTER statements and it should work.
CustomMeasure = CALCULATE(DISTINCTCOUNT('VW_Water'[CC_MASTER__ID]), FILTER('VW_Water','VW_Water'[CC_MAST_SUBTYPE]= "E*LEAK"), FILTER('VW_Water','VW_Water'[EarlyClosure]= "Double up"), FILTER('VW_Water','VW_Water'[Activity]= "Complete"))
Hope this helps!
Thanks @StevenGrenier
As suggested adding more FILTER statements has done the trick!
Try
CustomMeasure = CALCULATE(DISTINCTCOUNT('VW_Water'[CC_MASTER__ID]), FILTER('VW_Water','VW_Water'[CC_MAST_SUBTYPE]= "E*LEAK" && 'VW_Water'[EarlyClosure]= "Double up" && 'VW_Water'[Activity]= "Complete"))
CustomMeasure = CALCULATE(DISTINCTCOUNT('VW_Water'[CC_MASTER__ID]),'VW_Water'[CC_MAST_SUBTYPE]= "E*LEAK", 'VW_Water'[EarlyClosure]= "Double up",'VW_Water'[Activity]= "Complete")
if you need more help make me @
Appreciate your Kudos.
Better you use Datesqtd or totalqtd with date table. Rest you can add to calculate
Example
QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(('Date'[Date])))
Last QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-1,QUARTER)))
Last to last QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-2,QUARTER)))
Next QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],1,QUARTER)))
Last year same QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-1,Year)))
trailing QTR = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,QUARTER))
trailing 4 QTR = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-4,QUARTER))
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
111 | |
92 | |
84 | |
66 |