Forum Discussion

Farrah24's avatar
Farrah24
Frequent Visitor
3 years ago
Solved

Display status based on their value

Hi!

So i have data of App Sales for each platform, (A platform, B platform and C platform). I want to show the status of if the app is "Profitable"  or "Unprofitable" based on their summation between sales in A and C platform. The status of the app will give an output "Profitable" like in A-22 App, Category B50B in August 2000, and "Unprofitable" for A-22 App, B51 Category in Oct 2000.

I'm planning to show the status with Card Visualization with the date slicer.


Here is the data i used. I'm really new to DAX so i would really appreciate if anyone also can show the code in DAX. Thankyou in Advance!
Sales Data 

  • ddpl's avatar
    ddpl
    3 years ago

    Farrah24 try this one

     

    Status = var _D = CALCULATE(max('Table'[Date]),ALLSELECTED('Table'[Date]))
             return
             if(CALCULATE(sum('Table'[Platform A Sales, USD]) + sum('Table'[Platform C Sales, USD]),'Table'[Date] = _D) = 0 ,"Unprofitable " & _D,"Profitable " & _D)

3 Replies

  • ddpl's avatar
    ddpl
    Solution Sage

    Farrah24 Hi try by creating below measure for card visual.

     

    measure = var _A = sum('Tablename'[Platform A Sales, USD])
            var _B = SUM('Tablename'[Platform C Sales, USD])
            var _S = _A + _B
      return
           if(_S = 0 ,"Unprofitable","Profitable")
    • Farrah24's avatar
      Farrah24
      Frequent Visitor

      Hi! Thanks for your reply!

      I want to show the status dynamically with the last selected date in the slicer. I've tried to make slicer date in form of dropdown or list where it only have one value selected, and it work perfectly. But not when i have range of date, although i already make another measure to pick up last date selected its still not working. Here's the preview of my desktop, i also upload my pbix on last link. Thankyou in advance!

       

      • ddpl's avatar
        ddpl
        Solution Sage

        Farrah24 try this one

         

        Status = var _D = CALCULATE(max('Table'[Date]),ALLSELECTED('Table'[Date]))
                 return
                 if(CALCULATE(sum('Table'[Platform A Sales, USD]) + sum('Table'[Platform C Sales, USD]),'Table'[Date] = _D) = 0 ,"Unprofitable " & _D,"Profitable " & _D)