Forum Discussion

csaethre19's avatar
csaethre19
Helper II
3 years ago
Solved

Calculated Columns Affected By Slicer Filters

I have two calculated columns:

CalculatedColumn_FailureCount =
CALCULATE(
    COUNTROWS('public failure'),
    ALLEXCEPT('public failure', 'public failure'[Failure Mode], 'public failure'[Experiment Start Time])
) (this column is giving me the count based on the unique combinations of Failure Mode and Experiment Start Time)
 
and
 
CalculatedColumn_TotalRuns =
CALCULATE(
    DISTINCTCOUNT('public failure'[experimentId]),
    ALLEXCEPT('public failure', 'public failure'[Experiment Start Time])
) (this column is giving me the count of experimentIds to get a total run count for each day)
 
I have some slicers that are not affecting the counts provided in these calculated columns. They are correctly giving me the counts for the specified fields in these dax expressions but when I select a filter they are not re-calculated to provide an accurate count based on the filtered table. The table gets filtered but the values do not change based on the new filtered table and I need it to reflect that change. 
 
Is there a way I can do this?

 

Thanks!
  • csaethre19 

    I understood you wanted the overall for a day, Just do the below changes to the measures.

    TotalRuns_Test =
    CALCULATE (
    DISTINCTCOUNT ( 'Test'[Experiment Id] ),
    ALLEXCEPT ( Test, Test[Experiment Start Time] )
    )

    FailureRate_Test = [FailureCount_Test] / [TotalRuns_Test]

     

    Regards,
    Naveen




9 Replies

  • NaveenGandhi's avatar
    NaveenGandhi
    Memorable Member

    Hello csaethre19 

    Calculated columns cannot alter its calculation based on a slicer from report view. Create these same calculations as measure. That will work fine.

    Let me know if this helps!

    If this post helps, then please consider Accept it as the solution to help the others find it more quickly. Appreciate you kudos!!


    • csaethre19's avatar
      csaethre19
      Helper II

      Okay. Can you maybe point me in the right direction on how to accomplish a failure rate measure?

      So far I have these measures: 

      Measure_FailureCount = COUNT('public failure'[Failure Mode])
       
      and 
       
      Measure_TotalRuns =
      CALCULATE(
          DISTINCTCOUNT('public failure'[experimentId]),
          REMOVEFILTERS('public failureMode'[Failure Type], 'public failureMode'[Designation])
      )
       
      I need a third measure to calculate the failure rate based on these two measures.
      I have this:
      Measure_FailureRate = [Measure_FailureCount] / [Measure_TotalRuns]
       
      However, when I graph this failure rate vs. Experiment Start Time on a line chart and set the Legend to Failure Mode I get incorrect values. It appears to be dispalying just the Failure Count multiplied by 100. It does not consider the divide by total runs per day. 
      Here are some screenshots of some data I am looking at:

       

       

      As you can see from the table on May 1st I should show 20% for the failure mode in blue.


       

       
      • NaveenGandhi's avatar
        NaveenGandhi
        Memorable Member

        csaethre19 

        Can you provide sample data to understand the problem better, please make sure you include all the columns that will be required for calculation and visualisation.

        Regards,

        Naveen