Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Subtracting Value

Hi Team,

 

I have data,

 

expected Remaining value,

 

 

Thanks,

KV's

14 Replies

  • HI Anonymous 

    I'm not following the logic.  How do you get the final table from the starting table?

    Isn't the sum of z1 = 9.8 x 2 and sum of  Z2 = 11.5 x 4?

    Phil

    • Anonymous's avatar
      Anonymous
      Not applicable

      PhilipTreacy 

       

      Please review above screenshot , (Output Data) (Remaining Value)

  • Anonymous 

    Not very clear.  In oder to get your qs answered quickly please supply as much information as possible, provide sample data in a table that can be copied, or in a file - not only as screenshots, and be clear in your explanation.

    Where is this data stored?  Excel Tables?  Database?  Data model?

    Do you want a solution in Power Query or DAX?

    Is this the extent of the data or just a sample?

    Phil

  • V-lianl-msft's avatar
    V-lianl-msft
    Community Support

    Hi Anonymous ,

     

    Refer to:

    Measure = 
    var total_ = CALCULATE(SUM('Table'[Qas(m)]),ALLEXCEPT('Table','Table'[size]))
    return total_-MAX('Table'[Limit])

     

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi V-lianl-msft ,

       

      thanks for your reply,

       

      suppose Qas (m) and Limit is calculated column like new measure's then how do I calculate ?

       

      please help me.

      • V-lianl-msft's avatar
        V-lianl-msft
        Community Support

        Hi Anonymous ,

         

        If there is no sample file to view the measure details, there may be deviation.

        Please try:

        Measure = 
        var total = SUMX(ALLEXCEPT('Table','Table'[Size]),[Measure(Qas)])
        return total-[Measure(limit)]

        If the problem persists,could you share the sample pbix via cloud service like onedrive for business?

        Please remove any sensitive data before uploading.

         

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi V-lianl-msft ,

     

    The below formula is perfect for me, but the only problem is it works only if these data comes from the same table but my data are from different tables, 

    which is Table A contains (UID, Cat)
    Table B contains (Prod_Stock, Prod_Vol)
    if I club these two table's the desired result is not achieved therefore please find some other solution.

     

    Thanks,

    KV's

    • V-lianl-msft's avatar
      V-lianl-msft
      Community Support

      Hi Anonymous ,

       

      It is very difficult to analyze without looking at the data and just by imagining.

      Again,DAX measure are based on row context so any given value from slicers, filters, interactions with other visualizations, variables, relationships and so on can influence your result.

      Refer this blog to provide your sample data.

      https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216 

      Please remove any sensitive data before uploading.

       

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