Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi guys,
I have an issue with a calculation in Power BI. Probably this is easier than I can think, but I'm struggling with that.
I need to calculate the Sum(Total Sales) by days filtered in a Slicer. I also need to filter by city and country where the sale was sold.
I created this Measure, but I want to calculate for different cities to show in a Matrix:
Country | City | AT |
US | Miami | [AT US] |
ES | Madrid | [AT EU] |
ES | Barcelona | [AT EU] |
Thank you for your sugestion Sahir_Maharaj,
But didn't work yet. I did what you suggested, but column [AT] shows the value 1 or 0 for each row.
When I did the formula test1, the Sum(Total Sales) was divided by 1 or 0, and not the sum of days which I set on the Slicer.
This will calculate the sum of total sales for the city "Miami" and also consider the value of [AT] for the country. You can repeat the same steps for other cities as well.
Hope this helps! 🙂
2. Use the calculated column in your measure:
teste1 =
CALCULATE(
SUM('Sales'[Total Sales]),
'Sales'[City] = "Miami",
'Sales'[AT]
)
Here's how you can do it:
1. Create a calculated column with the following formula:
AT =
IF('Sales'[Country] = "US", [AT US],
IF('Sales'[Country] = "ES", [AT EU],
[AT]))
You can create a calculated column to store the [AT] value based on the country and then use the calculated column in the measure.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
70 | |
54 | |
38 | |
31 |
User | Count |
---|---|
78 | |
64 | |
64 | |
49 | |
45 |