Asyraf PHMR
Asyraf PHMR

Reputation: 29

YTD on single bar chart - using Slicer for month selection (PowerBI)

I would like to create a DAX that will make my visual (a single bar chart) display the YTD of a data [see below]

enter image description here

On top of that, I want it to be interactive to a slicer - in a way that i will only select a single month (example: August) & it will show data from Jan-Aug automatically.

Upvotes: 0

Views: 533

Answers (1)

Sam Nseir
Sam Nseir

Reputation: 12061

With a disconnected date table:

MyTotalYTD = 
  TOTALYTD(
    SUM('factTable'[Amount]),
    'connectedDateTable'[Date],
    FILTER(
      ALL('connectedDateTable'[Date]),
      'connectedDateTable'[Date] <= MAX('disconnectedDateTable'[Date])
    )
  )

// or

MyTotalYTD = 
  TOTALYTD(
    SUM('factTable'[Amount]),
    'factTable'[Date],
    FILTER(
      ALL('factTable'[Date]),
      'factTable'[Date] <= MAX('disconnectedDateTable'[Date])
    )
  )

Upvotes: 0

Related Questions