Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Semi Additive measure problem with multiple variables

I am working on a report on the amount of sensitive information each user is putting into emails, SharePoint documents, etc.  Every time a user edits a document, a new scan is done on that document and the amount sensitive information is recorded.

 

RowDateUserDocSensitive TypeCount
12/1Russtext1ABA2
22/10Russtext1ABA5
32/9Fredtext1ABA3
42/12Fredtext1ABA4
52/10Russtext1SSN6
62/2Russtext2ABA9
72/9Timtext3SSN7
82/15Timtext3SSN3

 

Assuming that I am reporting on the whole range of dates above, I want a set that is comprised of the bolded rows:

 

RowDateUserDocSensitive TypeCount
12/1Russtext1ABA2
22/10Russtext1ABA5
32/9Fredtext1ABA3
42/12Fredtext1ABA4
52/10Russtext1SSN6
62/2Russtext2ABA9
72/9Timtext3SSN7
82/15Timtext3SSN3

 

By the way, these columns are in five different tables (date, user, document, sensitive, and fact).

Here are a couple scenarios:

Total by Sensitive

ABA:  18 (rows 2,4,6)

SSN:  9 (rows 5, 😎

Total:  27

 

Total by User

Russ:  20 (Rows 2, 5,6)

Fred:  4 (Row 4)

Tim: 3 (Row 😎

Total:  27

 

Same principal for document.

 

Date would be more complicated, and would depart from the above.  If I report one row for each date, still filtered for the whole period, I would have one row for each date that has data, but the total would remain 27.

 

It wouldn't be pretty, but I could do this with SQL using the Last_Value and Rank functions.

 

All of the examples of semi-additive measures have one variable (account name, product name).  What I have is the equivalent of the owner of accounts in a bank and the accounts.  Or the inventory of product in different locations.

 

My search engine skills have failed me this time.  I look forward to hearing what options I have.

1 ACCEPTED SOLUTION
technolog
Super User
Super User

Alright, I get what you're trying to achieve. You want to get the latest value for each combination of User, Doc, and Sensitive Type, and then sum those up based on different scenarios. Let's break this down.

First, you'll need to create a measure that identifies the latest date for each combination of User, Doc, and Sensitive Type. You can use the MAXX function to do this.

Latest Date =
MAXX(
FILTER(
ALL('fact'),
'fact'[User] = EARLIER('fact'[User]) &&
'fact'[Doc] = EARLIER('fact'[Doc]) &&
'fact'[Sensitive Type] = EARLIER('fact'[Sensitive Type])
),
'fact'[Date]
)
Once you have the latest date, you can create a measure to get the Count for that latest date:

Latest Count =
CALCULATE(
SUM('fact'[Count]),
FILTER(
ALL('fact'),
'fact'[User] = EARLIER('fact'[User]) &&
'fact'[Doc] = EARLIER('fact'[Doc]) &&
'fact'[Sensitive Type] = EARLIER('fact'[Sensitive Type]) &&
'fact'[Date] = [Latest Date]
)
)
Now, you can use this Latest Count measure to sum up based on different scenarios:

Total by Sensitive: Just drag the Sensitive Type column to a table visual and then add the Latest Count measure. It will automatically sum up the latest counts for each sensitive type.
Total by User: Similarly, drag the User column to a table visual and then add the Latest Count measure. It will sum up the latest counts for each user.
Total by Document: You can do the same thing with the Doc column.
For the date scenario, you can drag the Date column to a table visual and then add the Latest Count measure. It will show the latest count for each date, but when you sum them up, it will still be 27 as you mentioned.

View solution in original post

1 REPLY 1
technolog
Super User
Super User

Alright, I get what you're trying to achieve. You want to get the latest value for each combination of User, Doc, and Sensitive Type, and then sum those up based on different scenarios. Let's break this down.

First, you'll need to create a measure that identifies the latest date for each combination of User, Doc, and Sensitive Type. You can use the MAXX function to do this.

Latest Date =
MAXX(
FILTER(
ALL('fact'),
'fact'[User] = EARLIER('fact'[User]) &&
'fact'[Doc] = EARLIER('fact'[Doc]) &&
'fact'[Sensitive Type] = EARLIER('fact'[Sensitive Type])
),
'fact'[Date]
)
Once you have the latest date, you can create a measure to get the Count for that latest date:

Latest Count =
CALCULATE(
SUM('fact'[Count]),
FILTER(
ALL('fact'),
'fact'[User] = EARLIER('fact'[User]) &&
'fact'[Doc] = EARLIER('fact'[Doc]) &&
'fact'[Sensitive Type] = EARLIER('fact'[Sensitive Type]) &&
'fact'[Date] = [Latest Date]
)
)
Now, you can use this Latest Count measure to sum up based on different scenarios:

Total by Sensitive: Just drag the Sensitive Type column to a table visual and then add the Latest Count measure. It will automatically sum up the latest counts for each sensitive type.
Total by User: Similarly, drag the User column to a table visual and then add the Latest Count measure. It will sum up the latest counts for each user.
Total by Document: You can do the same thing with the Doc column.
For the date scenario, you can drag the Date column to a table visual and then add the Latest Count measure. It will show the latest count for each date, but when you sum them up, it will still be 27 as you mentioned.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.