The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi there,
I am trying to create a measure that shows the average value of a column based on two filters. Sample dataset is below:
Table Name: | Sample Data | |
Location | Value | Date |
NY | 15 | 31/01/22 |
NY | 12 | 31/01/22 |
NY | 13 | 31/01/22 |
NY | 48 | 25/04/22 |
NY | 16 | 25/04/22 |
NY | 23 | 25/04/22 |
MD | 8 | 16/11/22 |
MD | 54 | 13/11/22 |
CA | 3 | 08/08/22 |
CA | 10 | 08/08/22 |
I need to get the average value of NY based on the same date. In this case, the desired result should look like this:
Table Name: | Sample Data | |
Location | Date | Average |
NY | 31/01/22 | 13.33 |
NY | 25/04/22 | 29 |
MD | 16/11/22 | 8 |
MD | 13/11/22 | 54 |
CA | 08/08/22 | 6.5 |
I've created this DAX measure:
AVERAGEX(
SUMMARIZE(
FILTER('Sample Data','Sample Data'[Location]="NY"),
'Sample Data'[Date],
'Sample Data'[Value]
),
'Sample Data'[Value]
)
But it's not giving me the desired output. Do I need to group the dates? Please help. Thank you
Solved! Go to Solution.
Hi Samsam,
I would create a calcualted table as below:
I am not sure about your use case for the mentioned measure. You could plot the expected table with the existing columns easily like below:
Hi Samsam,
I would create a calcualted table as below:
This worked! Thank you so much, FreemanZ. I've been raking my brains out since yesterday to find solution to this. I greatly appreaciate your help. 🙂
User | Count |
---|---|
20 | |
8 | |
7 | |
7 | |
6 |
User | Count |
---|---|
29 | |
11 | |
11 | |
9 | |
8 |