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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
stsok
Frequent Visitor

Removing line breaks in line chart when data is a DAX measure COUNTROWS()

I'm using a DAX measure for the red line in the image below and want to figure out how to make the red line continuous (show 0):

Screenshot 2024-01-29 130612.png

Context:

The red line represents the number of issues created in a Kanban board on a specific date. On the X-axis, there are two time-related variables (milestones and date hierarchy). The DAX measure I'm using for the red line (Y-axis) is as follows:

 

Issues Created =
COUNTROWS(
FILTER(
Dataset,
Dataset[IssueAction] = "created"
)
)

 

Essentially, this DAX measure counts occurrences in the 'IssueAction' column that match 'created'. The line break occurs when I select certain categories in the slicers (e.g., specific departments). My stakeholders want this line to appear continuous.

 

How can I configure the plot to show zero when there are no occurrences, or is this an impossible task?

 

Unlike the solutions in other posts on this forum, I can't convert the y-axis to "categorical" because it's already continuous (I don't even have the option to convert).

 

I've been searching for a solution to this issue for several days, but I couldn't figure it out.

 

Could someone help me with this? I appreciate your time.

 

1 ACCEPTED SOLUTION

@stsok 

you can modify your code as the below logic

var t =  TREATAS(values(dimdate[Date]) ,  'Table'[Date])
return
IF(
    not ISEMPTY( t ),
CALCULATE(
    COALESCE(SUM('Table'[sales]),0)    
)
)

 

summary ; 
the code will check if the date exists in your fact table, (base on your slicer date selection ) 

if exists , it will return the value and  0  in case of blank ,

 

if the date does not exist, it will return blank  ,which in turn power bi will not show the row for it, 

 

let me know if it works for you .

 

 

 

 

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution !
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

View solution in original post

4 REPLIES 4
lbendlin
Super User
Super User

To report on something that isn't there you need a disconnected table feeding your x axis.

Daniel29195
Super User
Super User

Hello @stsok 

Daniel29195_0-1706566587141.png

 

 

use this  measure : 

measure =  coalesce ( [measure] , 0 ) 


 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution !
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

Thank you for your response. I implemented your suggestion, but now I'm encountering a new issue where all the years are being repeated for each milestone.

Screenshot 2024-01-29 143847.png

When I utilize only COUNTROWS(), this issue doesn't arise (original view provided below).

Screenshot 2024-01-29 144224.png

I believe the challenge lies in the necessity for two separate x-axes on the chart.

Is there a method to incorporate COALESCE() while preserving the order of both x-axes?

 

@stsok 

you can modify your code as the below logic

var t =  TREATAS(values(dimdate[Date]) ,  'Table'[Date])
return
IF(
    not ISEMPTY( t ),
CALCULATE(
    COALESCE(SUM('Table'[sales]),0)    
)
)

 

summary ; 
the code will check if the date exists in your fact table, (base on your slicer date selection ) 

if exists , it will return the value and  0  in case of blank ,

 

if the date does not exist, it will return blank  ,which in turn power bi will not show the row for it, 

 

let me know if it works for you .

 

 

 

 

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution !
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.