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
Anonymous
Not applicable

Count number of points in my line chart

So I want to create a measure where I count the number of days in my linechart. So in the example below, you can see there is 29 dates so I want a measure that just contains the number 29, based on the count of the x-axis.

Just example.png

 

5 REPLIES 5
dax
Community Support
Community Support

Hi @Anonymous , 

I am not clear about your requirement, if possible could you please inform me more detailed information(such as your expected output and your sample data)? Then I will help you more correctly.

Please do mask sensitive data before uploading.

Thanks for your understanding and support.
Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

amitchandak
Super User
Super User

@Anonymous 

You can count the date when the measure is not bank or 0. the measure is the meausre of line and date is the date field

Calculate(count(Date[Date]),filter(table,[Measure]>0)

Or

Calculate(count(Date[Date]),filter(table,not(isblank([Measure])))

More than one measure

Calculate(count(Date[Date]),filter(table,not(isblank([Measure])) || not(isblank([Measure2])))

tex628
Community Champion
Community Champion

Hi,

This is a little hard with this information provided but i believe that you want something along the lines of:

Measure =
Countrows(
Summarize(
'Calendar';
Calendar[Date];
"Sum" ; [Your measure]
)
)


Let me know if it's correct or not 🙂 

Br,
J


Connect on LinkedIn
Anonymous
Not applicable

I will try explaining it a bit more, but might make it more difficult, but I certainly do not hope so. So I am comparing this line chart to another line chart, I select a date in the first chart and it plots, 29 days, 27 days, or an amount of dates (wherever data is available). So if the first line chart contains 29 days of data then my measure looks like this:

 

Days = IF(SELECTEDVALUE('Sales'[Date])>=SELECTEDVALUE('Calendar'[Date])&&SELECTEDVALUE('Sales'[Date])<SELECTEDVALUE('Calendar'[Date])+29;1;0)
 
One of the last lines is +29 because there is 29 days in the line chart, but when the line chart shows 27 days of data it should be +27. So I am trying to do the exact same measure just 
 
Days = IF(SELECTEDVALUE('Sales'[Date])>=SELECTEDVALUE('Calendar'[Date])&&SELECTEDVALUE('Sales'[Date])<SELECTEDVALUE('Calendar'[Date])+[Count of points in my first linechart]1;0)
tex628
Community Champion
Community Champion

What value are you getting if you use:

Measure =
Countrows(
Summarize(
ALLSELECTED('Calendar');
Calendar[Date];
"Sum" ; [Your measure]
)
)


It's hard to propose something because it's clear that there are row context related to the measure you want to create. It would be very helpful to se the other data that is present in the matrix where you want this measure. 

Br,
J


Connect on LinkedIn

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.