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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
RoHa
Frequent Visitor

KPI Visual not working properly

Hi all,

I have the following table:

RoHa_0-1717576063545.png


I want to have the KPI visual do the following:

1) When all months (month name) are selected in the slicer, it should show the total revenue (category = revenue) based on the GL Amount
2) When one month is selected, it should show the total revenue of that month
3) When two or more months are selected, it should show the total revenue of these months

This works perfectly fine in a card visual, however the KPI visual keeps giving the total revenue of the last month in my dataset. Also, it does not add up revenue of multiple months when selected. 

Please help!!

 

1 ACCEPTED SOLUTION

Hi @RoHa ,

You can create a measure as below and put it on the KPI visual to replace the original one. Later check if it can return the expected result...

Total Revenue = 
CALCULATE(
    SUM('YourTable'[GL Amount]),
    ALLSELECTED('YourTable'[Month])
)

vyiruanmsft_0-1718613671967.png

If the above one can't help you figure out, please provide some raw data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And it is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
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

7 REPLIES 7
RoHa
Frequent Visitor

Hey,

Thanks for your swift response. I'm unsure what I should add as the 'Table' after SUMX(. Please help here?

Hi @RoHa - please use your table name only ANT-Income Statement

 

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi @rajendraongole1 - I've created the measure according to your code, however I'm still facing the same issues. The KPI visual shows the revenue of the last "Month Name" in the set (May) when all months are selected. Also, when I select "January" and "March", the KPI visual will show the revenue of the latest "Month Name" selected. So, in this example we will see the revenue of March in the visual. Please refer below for some screenprints, please can you help here? If you need additional information let me know!

RoHa_0-1717579924510.pngRoHa_1-1717579956141.png

RoHa_2-1717579965375.png

 

 



Hi @RoHa ,

You can create a measure as below and put it on the KPI visual to replace the original one. Later check if it can return the expected result...

Total Revenue = 
CALCULATE(
    SUM('YourTable'[GL Amount]),
    ALLSELECTED('YourTable'[Month])
)

vyiruanmsft_0-1718613671967.png

If the above one can't help you figure out, please provide some raw data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And it is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

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

Hi @RoHa - Ok, can you try this measure and replace Yourtable and columns correctly.

 

Total Revenue =
VAR SelectedMonthCount = COUNTROWS(VALUES('YourTable'[Month Name]))
RETURN
SWITCH(
TRUE(),
SelectedMonthCount = COUNTROWS(ALL('YourTable'[Month Name])),
CALCULATE(SUM('YourTable'[GL Amount]), 'YourTable'[Category] = "Revenue"),
SelectedMonthCount = 1,
CALCULATE(SUM('YourTable'[GL Amount]), 'YourTable'[Category] = "Revenue", VALUES('YourTable'[Month Name])),
SelectedMonthCount > 1,
CALCULATE(SUM('YourTable'[GL Amount]), 'YourTable'[Category] = "Revenue", 'YourTable'[Month Name] IN VALUES('YourTable'[Month Name])),
BLANK()
)

 

Lets see. 

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi @rajendraongole1 - unfortunately, the issue still persists in the KPI visual. It's weird because in a card visual the code is working just fine.

rajendraongole1
Super User
Super User

Hi @RoHa - create a dax measue to calculate the total revenue based on the selected months. it should dynamically adjust its calculation based on the number of months selected in the slicer.

 

 

Total Revenue =
VAR SelectedMonths = SELECTEDVALUE('Table'[Month Name])
RETURN
SWITCH(
TRUE(),
ISINSCOPE('ANT-Income Statement'[Month Name]),
SUMX(
'Table',
IF('ANT-Income Statement'[Category] = "Revenue", 'ANT-Income Statement'[GL Amount], 0)
),
HASONEVALUE('ANT-Income Statement'[Month Name]),
CALCULATE(
SUM('ANT-Income Statement'[GL Amount]),
'ANT-Income Statement'[Category] = "Revenue",
'ANT-Income Statement'[Month Name] = SelectedMonths
),
CALCULATE(
SUM('ANT-Income Statement'[GL Amount]),
'ANT-Income Statement'[Category] = "Revenue",
'ANT-Income Statement'[Month Name] IN VALUES('ANT-Income Statement'[Month Name])
)
)

 

Modify the table name and columns as per your table, and add total revenue measure to indicator of kpi visual and add a slicer visual to month name.

 

Hope it works . Check it

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.