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

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.

Reply
Syndicate_Admin
Administrator
Administrator

SUMX with visual filters

Good morning community, I write because I have a problem that I have been trying to solve for some time.

I have a table with some records of failures, which have start date and end date, I made a measurement to calculate the duration of the failure. The important thing about this measure is that if I select a specific month and the failure has as its starting date a day corresponding to the month prior to the selected one, I should take as the starting date for the calculation of the duration of the failure the first day of the month, this in order to be consistent with the filters that I am applying.

TiempoIncidenteMin =
WHERE iniTime = .MAX( MIN('Tickets Maximo Base'[creationdate]), MIN('Maximum Tickets Calendar'[Date]) + 1)
WHERE finTime = MIN( MIN('Tickets Maximo Base'[actualfinish]), .MAX('Maximum Tickets Calendar'[Date]))
WHERE diff = DATEDIFF(iniTime, finTime, MINUTE)
RETURN
diff
csmonroy_0-1685631727916.png

The problem is that when I add this measurement to a table visual, the fault durations are calculated correctly. However, in the totals it gives me a number that is not consistent, as if instead of adding what is in the column it is evaluated with the total of the other columns I am using. I would like to add all the durations of the failures in the total. I already tried using SUMX but this does not evaluate the month filters applied in the view.
Attached pbix in case anyone can help me.
1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a measure. 

Total_TiempoIncidenteMin = 
SUMX(VALUES('Tickets Maximo Base'[cinum]),[TiempoIncidenteMin])

(3) Then the result is as follows.

vtangjiemsft_0-1686626179169.png

vtangjiemsft_1-1686626191892.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

2 REPLIES 2
v-tangjie-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a measure. 

Total_TiempoIncidenteMin = 
SUMX(VALUES('Tickets Maximo Base'[cinum]),[TiempoIncidenteMin])

(3) Then the result is as follows.

vtangjiemsft_0-1686626179169.png

vtangjiemsft_1-1686626191892.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

lbendlin
Super User
Super User

The important thing about this measure is that if I select a specific month and the failure has as its starting date a day corresponding to the month prior to the selected one, I should take as the starting date for the calculation of the duration of the failure the first day of the month, this in order to be consistent with the filters that I am applying.

I didn't get this part, can you please elaborate?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors