Forum Discussion

Emranit's avatar
Emranit
Helper II
1 year ago
Solved

Need help regarding DAX

In my attached excel file, 1] 500kg machine have 03pcs, 750kg machine have 04pcs, 1000kg machine have 02pcs, 1200kg machine have 01pcs, 1500kg machine have 01pcs 2] Total Dyelot no quantity is 11 ...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Emranit ,
    Thank you for reaching out to the Microsoft Fabric Community Forum about the issue you are encountering.

    Based on my understanding, the following DAX measure might help you address the query:

                  Dyelot Per Machine = VAR TotalDyelot = 11 
                  DIVIDE(TotalDyelot, SELECTEDVALUE('Machines'[Machine Count]), BLANK())

    To get the divided result on top of the bar of each value machine, select a clustered column chart :

    • Use Machine Weight (kg) as the X-axis
    • Use Machine Count as the Y-axis

    Display the Dyelot per Machine (new measure) as data labels on top of each bar. To enable data labels:

    • Click on the chart ,select Format then turn on Data Labels
    • Set labels to show Dyelot Per Machine value

    Refer the attached file for more clarification.

    If this post helps, please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Emranit ,

    Thanks for your follow-up! Based on your request, you may use the following DAX formula to calculate the average number of machines by dividing the total selected machines by the unique machine count:

    new Average_Machines =
    VAR TotalMachines = COUNTROWS(ALLSELECTED('Machine'))  
    VAR UniqueMachines = CALCULATE(DISTINCTCOUNT('Machine'[Machine Info]), ALLSELECTED('Machine'))  

    RETURN
    DIVIDE(TotalMachines, UniqueMachines, 0)


    For better understanding, I have created a new measure to get the average value.Please refer the below screenshot for clear understanding.

     

    You can either modify your existing card measure or create a new measure using this formula to get the average as needed. Let me know if you need any further adjustments!

    I hope this helps.Thank you for your cooperation. Have a great day.

    Regards,
    Pallavi.