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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Syndicate_Admin
Administrator
Administrator

Show a card calculation depending on column

good.

I think it's a simple thing, but I can't get it to work for me in Power Bi, I want to put a card that according to one IF shows one type of measure or another.

The problem I have in the table that I want to compare, I want if the value of a column is to 0 I will show a sum(total19) and if this to 1 shows an average(Average19). The idea is like this:

Card - If (Type-0, Total19, Average19)

Total - SUM(Rows[Value])

Total19 - CALCULATE([Total], Rows[Year]-2019)
Average19 ? AVERAGEX(Rows,[Total19])
if.png
Thanks a lot.
a greeting
1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @Syndicate_Admin ,

 

According to the test file you provided, I did the following test:

Result =
VAR a =
    CALCULATE ( SUM ( Hoja1[Valor] ), FILTER ( ALL ( Hoja1 ), Hoja1[Año] = 2019 ) )
VAR b =
    CALCULATE (
        AVERAGE ( Hoja1[Valor] ),
        FILTER ( ALL ( Hoja1 ), Hoja1[Año] = 2019 )
    )
RETURN
    IF ( MAX ( Hoja1[Tipo] ) = 1, a, b )

v-henryk-mstf_0-1621496487316.png

v-henryk-mstf_1-1621496500695.png

 


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.

Best Regards,
Henry

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

 

Below is test pbix file.

View solution in original post

3 REPLIES 3
v-henryk-mstf
Community Support
Community Support

Hi @Syndicate_Admin ,

 

According to the test file you provided, I did the following test:

Result =
VAR a =
    CALCULATE ( SUM ( Hoja1[Valor] ), FILTER ( ALL ( Hoja1 ), Hoja1[Año] = 2019 ) )
VAR b =
    CALCULATE (
        AVERAGE ( Hoja1[Valor] ),
        FILTER ( ALL ( Hoja1 ), Hoja1[Año] = 2019 )
    )
RETURN
    IF ( MAX ( Hoja1[Tipo] ) = 1, a, b )

v-henryk-mstf_0-1621496487316.png

v-henryk-mstf_1-1621496500695.png

 


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.

Best Regards,
Henry

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

 

Below is test pbix file.

amitchandak
Super User
Super User

@Syndicate_Admin , do need something like a measure slicer ?

refer my video if that can help

How to create a Measure Slicer: https://youtu.be/b9352Vxuj-M

 

or

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello I have created an example, it is simple, a single table in which I have two filters, and what I want on a single card, that if it is type 1 show me the total and if the type 0 shows me the average

example

Thank you

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors