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 have the following query results:
I want to create one row for China with the sum of all the values for China on a given day. In this case the row results would look like this:
Western Pacific | China | 278 | 1/20/2020
How do I alter my query to acheive this?
Solved! Go to Solution.
@Wonder
Ok, sorry for misunderstanding.
You can do that as well in Power Query.
Just go in Transform - Group By then select Advanced (in order to group by multiple columns) and choose your columns along with the aggregated one.
Afterwards, if you want the results for China only, you can filter the Country column to China.
Kind regards,
Razwan
@Razwan This appears to have solved the problem. Thanks for suggesting the Advanced radio button, I had missed it in my previous attempts using this feature.
@Wonder
Hi, you can achieve this very easily using DAX.
Just create a measure for total cases per date:
# Total Cases =
CALCULATE(
SUM(YourTable[Confirmed Cases]),
ALLEXCEPT(YourTable,
YourTable[WHO Regional Office],
YourTable[Country],
YourTable[Reporting Date]
)
)
Then a calculated table using the measure previously created:
CalcTable =
SUMMARIZE(
FILTER(
YourTable,
YourTable[Country] = "China"
),
YourTable[WHO Regional Office],
YourTable[Country],
YourTable[Reporting Date],
"Total Cases", [# Total Cases]
)
Please let me know how it works.
Kind regards,
Razwan
I am looking to alter the query to retreive the data correctly not show the data in a report in the right format. The data will later be appened to another query or queries. So it has to match the signle row format. I cross posted on the power query forum as well. Thanks for your solution, but I am wondering how to alter my query.
@Wonder
Ok, sorry for misunderstanding.
You can do that as well in Power Query.
Just go in Transform - Group By then select Advanced (in order to group by multiple columns) and choose your columns along with the aggregated one.
Afterwards, if you want the results for China only, you can filter the Country column to China.
Kind regards,
Razwan
@Razwan This appears to have solved the problem. Thanks for suggesting the Advanced radio button, I had missed it in my previous attempts using this feature.
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 |
---|---|
110 | |
95 | |
76 | |
65 | |
51 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |