Forum Discussion
Frisbeeous
2 years agoFrequent Visitor
How do I get a Visual Like this
I am trying to reproduce this visual in Power BI. I have 3 major tables. The Main table, let's call it Query1, a second table with Dates, let's call it a DateTable, ...
ExcelMonke
2 years agoImpactful Individual
Hello, I tackled something similar. My solution was to have a single select slicer available to the end-user where they could select either WTD, MTD, QTD, or YTD. Then, I had a measure with the following:
Previous Time Count =
VAR CurrentDate = LASTDATE(DateDim[Date])
VAR Selection = SELECTEDVALUE(TimeFrameSelector[Time Frame])
VAR Previous_Y = Year(MAX(DateDim[Date]))-1
VAR Previous_M = MONTH(MAX(DateDim[Date]))-1
VAR Previous_Q = QUARTER(MAX(DateDim[Date]))-1
VAR Previous_W = WEEKDAY(LASTDATE(DateDim[Date]),3)
RETURN
SWITCH(
TRUE(),
Selection = "Month to Date", CALCULATE(COUNT(Table1[Data]),FILTER(ALL(DateDim),MONTH(DateDim[Date])=Previous_M)),
Selection = "Quarter to Date", CALCULATE(COUNT(Table1[Data]),FILTER(ALL(DateDim),Quarter(DateDim[Date])=Previous_Q)),
Selection = "Week to Date", CALCULATE(COUNT(Table1[Data]),FILTER(ALL(DateDim),WEEKNUM(DateDim[Date])=Previous_W)),
Selection = "Year to Date", CALCULATE(COUNT(Table1[Data]),FILTER(ALL(DateDim),Year(DateDim[Date])=Previous_Y)),
"All"
)
Hope this gets you started in the right direction!