Forum Discussion
Using CALCULATE to summarize different values
- 1 year ago
1. Go to the 'Folders Summary' Table
In Power BI's Data View, select the 'Folders Summary' table from the Data pane on the right.2. Create a New Column
From the Table tools ribbon at the top, click New column.3. Enter the DAX Formula
In the formula bar, enter the following DAX expression. This formula calculates the sum for each folder in your summary table.Items =
VAR CurrentFolder = 'Folders Summary'[Folder Name]
RETURN
CALCULATE (
SUM ( 'Folders'[Items] ),
FILTER (
'Folders',
'Folders'[Folder Name] = CurrentFolder
|| STARTSWITH ( 'Folders'[Folder Name], CurrentFolder & "\" )
)
)
After you press Enter, the new Items column will be populated with the correct totals.If this explanation and solution resolve your issue, please like and accept the solution.
1. Go to the 'Folders Summary' Table
In Power BI's Data View, select the 'Folders Summary' table from the Data pane on the right.
2. Create a New Column
From the Table tools ribbon at the top, click New column.
3. Enter the DAX Formula
In the formula bar, enter the following DAX expression. This formula calculates the sum for each folder in your summary table.
Items =
VAR CurrentFolder = 'Folders Summary'[Folder Name]
RETURN
CALCULATE (
SUM ( 'Folders'[Items] ),
FILTER (
'Folders',
'Folders'[Folder Name] = CurrentFolder
|| STARTSWITH ( 'Folders'[Folder Name], CurrentFolder & "\" )
)
)
After you press Enter, the new Items column will be populated with the correct totals.
If this explanation and solution resolve your issue, please like and accept the solution.