Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Goodday,
I have a problem and hope you guys can help. I have the following graph, where i replaced blank values with 0:
My goal is to make it like this
This Graph Follows a slicer that is on the page.
To make the graph more concise i am trying to keep the values before and after any data Blank, and between data i want it to display 0. As if this graph would start at 2021-12 and end at 2022-7, but dynamicly based on the slicer.
Based on the following link i made a measure to count it;
I have been fiddeling with the NOTS, <> and all other things to get it to work, but i am just not able. Do you guys have any idea how to solve this?
Solved! Go to Solution.
Dates is a dim that stores all dates from the 2000 year.
Graph Value =
var CurrentDate = SELECTEDVALUE( Dates[Date] )
var MinDateWithNonZeroData =
CALCULATE(
MINX(
FILTER(
Graph,
Graph[Value] > 0
),
Graph[Date]
),
ALLSELECTED( Dates )
)
var MaxDateWithNonZeroData =
CALCULATE(
MAXX(
FILTER(
Graph,
Graph[Value] > 0
),
Graph[Date]
),
ALLSELECTED( Dates )
)
var GraphValue =
if( MinDateWithNonZeroData <= CurrentDate
&& CurrentDate <= MaxDateWithNonZeroData
&& not ISBLANK( MinDateWithNonZeroData ),
CALCULATE(
SUM( Graph[Value] ) + 0,
TREATAS(
{ CurrentDate },
Graph[Date]
)
)
)
return
GraphValue
Thank you very much! It works great! I even got it working with just Year-Month Values
Dates is a dim that stores all dates from the 2000 year.
Graph Value =
var CurrentDate = SELECTEDVALUE( Dates[Date] )
var MinDateWithNonZeroData =
CALCULATE(
MINX(
FILTER(
Graph,
Graph[Value] > 0
),
Graph[Date]
),
ALLSELECTED( Dates )
)
var MaxDateWithNonZeroData =
CALCULATE(
MAXX(
FILTER(
Graph,
Graph[Value] > 0
),
Graph[Date]
),
ALLSELECTED( Dates )
)
var GraphValue =
if( MinDateWithNonZeroData <= CurrentDate
&& CurrentDate <= MaxDateWithNonZeroData
&& not ISBLANK( MinDateWithNonZeroData ),
CALCULATE(
SUM( Graph[Value] ) + 0,
TREATAS(
{ CurrentDate },
Graph[Date]
)
)
)
return
GraphValue
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
7 | |
6 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |