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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
netanel
Post Prodigy
Post Prodigy

Gross + If

Hi All!

 

I have this measure:

Gross USD=CALCULATE( DIVIDE( SUM( 'DB 2021'[Gross USD] ), COUNTROWS( 'Date' ) ),

   keepfilters(  'Date'[Date] < TODAY()))

 

And I want to put the following condition into it:

If the Source = "Amn" then bring me both Gross USD and Fee
Otherwise just bring me Gross USD

Source condition.JPG

 

 

 

 

 

 

 

 

 

Thanks for the helpers!








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

Connect on Linkedin
linkedin.com/in/netanel-shriki
1 ACCEPTED SOLUTION
Samarth_18
Community Champion
Community Champion

Hi @netanel ,

 

You can try below code:-

Gross USD =
IF (
    SELECTEDVALUE ( 'Table'[Source] ) = "Amn",
    CALCULATE (
        DIVIDE (
            ( SUM ( 'DB 2021'[Gross USD] ) + SUM ( 'DB 2021'[Fee] ) ),
            COUNTROWS ( 'Date' )
        ),
        KEEPFILTERS ( 'Date'[Date] < TODAY () )
    ),
    CALCULATE (
        DIVIDE ( SUM ( 'DB 2021'[Gross USD] ), COUNTROWS ( 'Date' ) ),
        KEEPFILTERS ( 'Date'[Date] < TODAY () )
    )
)

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

4 REPLIES 4
Samarth_18
Community Champion
Community Champion

Hi @netanel ,

 

You can try below code:-

Gross USD =
IF (
    SELECTEDVALUE ( 'Table'[Source] ) = "Amn",
    CALCULATE (
        DIVIDE (
            ( SUM ( 'DB 2021'[Gross USD] ) + SUM ( 'DB 2021'[Fee] ) ),
            COUNTROWS ( 'Date' )
        ),
        KEEPFILTERS ( 'Date'[Date] < TODAY () )
    ),
    CALCULATE (
        DIVIDE ( SUM ( 'DB 2021'[Gross USD] ), COUNTROWS ( 'Date' ) ),
        KEEPFILTERS ( 'Date'[Date] < TODAY () )
    )
)

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

ValtteriN
Super User
Super User

Hi,

You can include IF to your Fee measure. So something like this
Measure = IF(SELECTEDVALUE('Table'[Source])<>"Amn",BLANK(),[FEE])

With this the measure will display blank if the Source is something besides Amn. I hope this helps and if it does consider accepting this as a solution and giving the post a thumbs up!





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

Proud to be a Super User!




Hi @ValtteriN 

 

I'm really getting close to the result in the idea you proposed
Only at the end of the formula:
Measure = IF (SELECTEDVALUE ('Table' [Source]) <> "Amn", BLANK (), [FEE])

What is marked in pink is a column in a table and not a formula
How to bring it?








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

Connect on Linkedin
linkedin.com/in/netanel-shriki

Hi,

Then you can just use the same logic with that column:
Measure = IF (SELECTEDVALUE ('Table' [Source]) <> "Amn", BLANK (), SELECTEDVALUE('Table'[FEE]))





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

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.