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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
prasala
Regular Visitor

how to write Dax for : if sum on a column is grater then another column then true

Hi All, 

My table 

 

Userdeprttotal mindaysusersorders
aaasjb 49352520
aaasjb 4252520
aaasjb 40.452520

 

now I must do a sum of total min and see if it is grater then 6*days, if it is grater then it is true else false.
so, for above data sum of total min = 95.4
6*days will be 6*5 = 30
so, my values need to be true
but I am unable to replicate same in power bi when i using a measure i was able to take the sum (total min) but unable to get the 6*days expression.
I don’t need sum of days, just sum of total min > 6* days.
how can I do it?

1 ACCEPTED SOLUTION
v-yaningy-msft
Community Support
Community Support

Hi,  @prasala 

You can refer to @Syk  latest reply, if it does not work, you can refer to the following DAX.

vyaningymsft_0-1714986807614.png


DAX:

True or False = 
VAR _max_TotalMin =
    CALCULATE ( MAX ( 'Table'[total min] ), ALLEXCEPT ( 'Table', 'Table'[User] ) )
VAR _result =
    IF ( _max_TotalMin > SELECTEDVALUE ( 'Table'[days] ) * 0.6, "true", "false" )
RETURN
    _result

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

4 REPLIES 4
v-yaningy-msft
Community Support
Community Support

Hi,  @prasala 

You can refer to @Syk  latest reply, if it does not work, you can refer to the following DAX.

vyaningymsft_0-1714986807614.png


DAX:

True or False = 
VAR _max_TotalMin =
    CALCULATE ( MAX ( 'Table'[total min] ), ALLEXCEPT ( 'Table', 'Table'[User] ) )
VAR _result =
    IF ( _max_TotalMin > SELECTEDVALUE ( 'Table'[days] ) * 0.6, "true", "false" )
RETURN
    _result

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

prasala
Regular Visitor

Not exactly what my requirement is 
For the person aaa I need a single value if it is true or false
So I need sum(total min) > 6* (days)

if it true then i need true for the user aaa not per row it should be per user 

Try this

User Check = var totalmin = SUM('Table'[total min])
var sixxdays = AVERAGE('Table'[days])*6
RETURN if (totalmin > sixxdays,TRUE(),FALSE())

 

Syk_0-1714679726845.png

 

Syk
Super User
Super User

Add a custom column and use this logic 

if [total min] >  6*[days] then "True" else "False"

 

Syk_0-1714678758814.png

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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