Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ghutchins
Helper II
Helper II

Date limit columns differently in one data visual

I have a visual that is showing the status of 4 columns.  It is easy to date limit the whole table by dropping the data into the filter for the visual or the page, but I need to date filter all the columns with a different start date 'Column A' differently than I filter 'Column B'  Guessing I need to do this in the Calculated column but am struggling with how to do it most efficiently.

 

Value = CALCULATE(SUM('ColumnValue'/COUNT('Columns), Column A starts 6/1/2022, Column B starts 7/1/2022, Column C starts 8/1/2022, Column D Starts 9/1/2022)) 

 

ghutchins_0-1662980887282.png

Any help is appreciated...

1 ACCEPTED SOLUTION
ReneMoawad
Resolver II
Resolver II

Hi @ghutchins,

 

You need to create a new measure
Value 
Var selectedColumn = SELECTEDVALUE(Table[Column])

Var startDate = SWITCH(selectedColumn

    , "Column A", DATE(2022, 6, 1)

    , "Column B", DATE(2022, 7, 1)

    , "Column C", DATE(2022, 8, 1)

    , "Column D", DATE(2022, 9, 1)

)

Var endDate = MAX(Table[DateColumn])
RETURN

CALCULATE(

    SUM('ColumnValue') COUNT('Columns)

    , ALL(Table[DateColumn])

    , Table[DateColumn] >= startDate

    . Table[DateColumn] <= endDate
)

View solution in original post

2 REPLIES 2
ReneMoawad
Resolver II
Resolver II

Hi @ghutchins,

 

You need to create a new measure
Value 
Var selectedColumn = SELECTEDVALUE(Table[Column])

Var startDate = SWITCH(selectedColumn

    , "Column A", DATE(2022, 6, 1)

    , "Column B", DATE(2022, 7, 1)

    , "Column C", DATE(2022, 8, 1)

    , "Column D", DATE(2022, 9, 1)

)

Var endDate = MAX(Table[DateColumn])
RETURN

CALCULATE(

    SUM('ColumnValue') COUNT('Columns)

    , ALL(Table[DateColumn])

    , Table[DateColumn] >= startDate

    . Table[DateColumn] <= endDate
)

Thanks...  that was the answer i was looking for!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors