March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I have created a calculated table in Power BI that shows the information above:
Period; Index [which are some measures, one for each period, like: Sales2023, SalesJanuary2024, etc]; Area
The problem is, no matter the area, I'm getting the same values to the same period, like this:
January/2024: 1,5%, Finance
January/2024: 1,5%, IT
Any ideas to solve this? Thank you in advance.
Solved! Go to Solution.
Hi @miikasa , Not a lot of information to work with. maybe provide us screenshots of your table and columns?
anyway try this:
To address the issue where the same values are being shown for different areas in your calculated table, we need to ensure that the measures you're using are being correctly filtered by the Area context. This involves making sure that your measures account for the Area context in their calculations.
Here’s a general approach to troubleshoot and solve this issue:
Example:
Assuming you have a measure Sales2023 and you want it to be correctly filtered by Area, here is how you might adjust your measure:
Sales2023 =
CALCULATE(
SUM(SalesTable[SalesAmount]),
FILTER(
SalesTable,
SalesTable[Year] = 2023
)
)
If the Area is not being considered, you can make sure it is included in the calculation:
Sales2023 =
CALCULATE(
SUM(SalesTable[SalesAmount]),
SalesTable[Year] = 2023,
SalesTable[Area] = SELECTEDVALUE(AreaTable[Area])
)
Creating the Calculated Table:
When creating the calculated table, make sure that you include the Area in the context of the measures. Here’s an example of how to create a calculated table that correctly filters by Area:
CalculatedTable =
ADDCOLUMNS(
GENERATE(
ALL(PeriodTable[Period]),
VALUES(AreaTable[Area])
),
"Index",
SWITCH(
TRUE(),
[Period] = "2023", [Sales2023],
[Period] = "January2024", [SalesJanuary2024],
...
)
)
In this example:
Example Data Model:
Consider a data model where SalesTable contains sales data, PeriodTable contains period information, and AreaTable contains area information. Ensure that there are relationships set up correctly between these tables, especially connecting SalesTable to AreaTable through an AreaID or similar field.
Verification:
By ensuring that your measures are correctly filtered by Area and that your calculated table respects these filters, you should be able to resolve the issue where the same values appear for different areas.
Hey, thank you so much for your answer. I tried what you said, I'm not sure why it didn't work. There is still a problem when it comes to calculate the index to each area.
What I want is to create a calculated column as below:
Period Value Area
Accumulated 2023 [AccSales2023] Finance
January 2024 [SalesJan2024] Finance
February 2024 [SalesFeb2024] Finance
Accumulated 2023 [SalesJan2024] IT
January 2024 [SalesJan2024] IT
February 2024 [SalesFeb2024] IT
So, I'll share the measures I created, maybe it could be helpful for you to understand.
I have 4 tables: Sales,BoardSales, Calendar, Areas
These are my measures:
SalesNumber = SUM(Sales[SalesAmount])
MonthlySum=
CALCULATE( SUM('BoardSales'[TOTAL]),
ALLEXCEPT('BoardSales', 'BoardSales'[Month-Year]) )
PreviousMonthSum =
CALCULATE( [MonthlySum], PREVIOUSMONTH('BoardSales'[Month-Year]) )
AverageCurrentMonthvsPreviousMonth =
IF( ISBLANK([PreviousMonth]),
BLANK(),
([MonthlySum] + [PreviousMonth]) / 2 )
SalesIndex=
What I need to demonstrate in the calculated table:
AccSales2023=
CALCULATE(
SalesJanuary2024=
CALCULATE(
[SalesIndex],
'Calendar'[Date] >= DATE(2024, 1, 1) && 'Calendar'[Date] <= DATE(2024, 1, 31),
ALL('Calendar'),
ALLSELECTED(Areas[AREAS])
)
Hope it can be helpful and thank you again!
could you pls provide some sample data and expected output?
Proud to be a Super User!
Hi there, thank you for your message.
What I want is to create a calculated column as below:
Period Value Area
Accumulated 2023 [AccSales2023] Finance
January 2024 [SalesJan2024] Finance
February 2024 [SalesFeb2024] Finance
Accumulated 2023 [SalesJan2024] IT
January 2024 [SalesJan2024] IT
February 2024 [SalesFeb2024] IT
So, I'll share the measures I created, maybe it could be helpful for you to understand.
I have 4 tables: Sales,BoardSales, Calendar, Areas
These are my measures:
SalesNumber = SUM(Sales[SalesAmount])
MonthlySum=
CALCULATE( SUM('BoardSales'[TOTAL]),
ALLEXCEPT('BoardSales', 'BoardSales'[Month-Year]) )
PreviousMonthSum =
CALCULATE( [MonthlySum], PREVIOUSMONTH('BoardSales'[Month-Year]) )
AverageCurrentMonthvsPreviousMonth =
IF( ISBLANK([PreviousMonth]),
BLANK(),
([MonthlySum] + [PreviousMonth]) / 2 )
SalesIndex=
What I need to demonstrate in the calculated table:
AccSales2023=
CALCULATE(
SalesJanuary2024=
CALCULATE(
[SalesIndex],
'Calendar'[Date] >= DATE(2024, 1, 1) && 'Calendar'[Date] <= DATE(2024, 1, 31),
ALL('Calendar'),
ALLSELECTED(Areas[AREAS])
)
Hope it can be helpful and thank you!
Hi @miikasa , Not a lot of information to work with. maybe provide us screenshots of your table and columns?
anyway try this:
To address the issue where the same values are being shown for different areas in your calculated table, we need to ensure that the measures you're using are being correctly filtered by the Area context. This involves making sure that your measures account for the Area context in their calculations.
Here’s a general approach to troubleshoot and solve this issue:
Example:
Assuming you have a measure Sales2023 and you want it to be correctly filtered by Area, here is how you might adjust your measure:
Sales2023 =
CALCULATE(
SUM(SalesTable[SalesAmount]),
FILTER(
SalesTable,
SalesTable[Year] = 2023
)
)
If the Area is not being considered, you can make sure it is included in the calculation:
Sales2023 =
CALCULATE(
SUM(SalesTable[SalesAmount]),
SalesTable[Year] = 2023,
SalesTable[Area] = SELECTEDVALUE(AreaTable[Area])
)
Creating the Calculated Table:
When creating the calculated table, make sure that you include the Area in the context of the measures. Here’s an example of how to create a calculated table that correctly filters by Area:
CalculatedTable =
ADDCOLUMNS(
GENERATE(
ALL(PeriodTable[Period]),
VALUES(AreaTable[Area])
),
"Index",
SWITCH(
TRUE(),
[Period] = "2023", [Sales2023],
[Period] = "January2024", [SalesJanuary2024],
...
)
)
In this example:
Example Data Model:
Consider a data model where SalesTable contains sales data, PeriodTable contains period information, and AreaTable contains area information. Ensure that there are relationships set up correctly between these tables, especially connecting SalesTable to AreaTable through an AreaID or similar field.
Verification:
By ensuring that your measures are correctly filtered by Area and that your calculated table respects these filters, you should be able to resolve the issue where the same values appear for different areas.
Hi there, I tried again and it worked! I'll just confirm the values, but now the filters of areas is working.
I can't thank you enough.
Warm regards.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |