Forum Discussion

Dronning's avatar
Dronning
New Member
1 year ago
Solved

Dax help

Date Value Supplier 2025-01-01 20 S1 2025-01-01 23 S1 2025-01-03 38 S1 2025-01-03 52 S1 2025-01-01 12 S1 2025-01-03 23 S1 2025-01-04 64 S1 2025-01...
  • MFelix's avatar
    1 year ago

    Hi Dronning ,

     

    You need to create a table with dates value to use on a slicer then use the following changes to your measures:

    MeasureS1 = IF(
    			SELECTEDVALUE('Table'[Date]) IN VALUES(Dates[Date]),
    			CALCULATE(
    				SUM('Table'[Value]) * SELECTEDVALUE(S1Factor[S1]),
    				FILTER(
    					'Table',
    					'Table'[Supplier] = "S1"
    				)
    			),
    			CALCULATE(
    				SUM('Table'[Value]),
    				'Table'[Supplier] = "S1"
    			)
    		)
    
    

     

     

    Chexh file attach.

     

  • parry2k's avatar
    1 year ago

    Dronning My friend MFelix has given an awesome solution, here is another version of the calculation. This will show the total correctly in the table visual if you ever decide to visualize using matrix/table visual otherwise please follow what MFelix provided. Cheers!

     

    Measure S1 = 
    VAR __SelectedDates = VALUES ( 'Date Slicer'[Date] )
    RETURN
    SUMX (
        FILTER ( 
            Supplier,
            Supplier[Supplier] = "S1" 
        ),
        VAR __S1ParameterValue = IF ( Supplier[Date] IN __SelectedDates,  SELECTEDVALUE(S1Factor[S1]), 1 )
        VAR __Value = Supplier[Value] * __S1ParameterValue
        RETURN
        __Value
    )