sparkline
3 TopicsIgnore filter on my measure
Hello, I’m using a Sparkline generated via an API, and it’s working perfectly. Each dot corresponds to a week, allowing me to see the variation over time from the start of my dataset. However, I’ve encountered a challenge: I want to filter my page data (e.g., using a slicer) to focus on specific weeks, such as Week 31 of the year. This should dynamically update all visuals on the page. However, I also want the Sparkline visual to always show the total data (ignoring any filters) to provide a full historical view. I can’t disable the interaction between the filter and the Sparkline visual because I’m also using a card and a main measure on the page. These elements need to reflect the filtered data based on the selected date range. Here’s the current code for my Sparkline: As an example, here's how it looks like when no filter is applied : And here is how it looks like when I filter on 3 weeks : The data change to 5484 which is great but my sparkline also changes as well, I would like it to stay unfiltered. Thank you in advance.1KViews0likes3CommentsSparklines showing 12 month period
Hi, so I have to implement sparklines in my table using dax code. I found exmaples online that worked by generating a SVG image! However, I want to modify the code and seem to be hitting some hard ends. This code generates a svg sparkline that takes into Months (MonthID), and fully reacts depending on how I filter the visual. So, if I filter the last year, my sparklines show only the months for that year. However, I need them to show the last 12 months regardless of year. I know how to do this in general, but I can't understand what I need to modify. I tried modifying xMinDate = MAX('History'[MonthID]) -12 but it's not working. Just moving the graph a bit. I am fairly sure I need to modify something in the bolded piece of code below. Any help would be appreciated! Sparkline Line orders year = // Static line color VAR LineColor = "#01B8AA" // "Date" field used in this example along the X axis VAR XMinDate = Min('History'[MonthID]) VAR XMaxDate = MAX('History'[MonthID]) // Obtain overall min and overall max measure values when evaluated for each date VAR YMinValue = MINX(VALUES('History'[MonthID]),CALCULATE([AvgWeek])) VAR YMaxValue = MAXX(VALUES('History'[MonthID]),CALCULATE([AvgWeek])) // Build table of X & Y coordinates and fit to 100 x 100 viewbox VAR SparklineTable = ADDCOLUMNS( SUMMARIZE('History','History'[MonthID]), "X",INT(85 * DIVIDE('History'[MonthID] - XMinDate, XMaxDate - XMinDate)), "Y",INT(85 * DIVIDE([AvgWeek] - YMinValue,YMaxValue - YMinValue))) // Concatenate X & Y coordinates to build the sparkline VAR Lines = CONCATENATEX(SparklineTable,[X] & "," & 100-[Y]," ", [MonthID]) // Add to SVG, and verify Data Category is set to Image URL for this measure VAR SVGImageURL = IF(HASONEVALUE('CSR'[CSR_Name]) && [AvgWeek]<>blank(), "data:image/svg+xml;utf8," & "<svg xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' viewBox='0 0 100 100'>" & "<polyline fill='none' stroke='" & LineColor & "' stroke-width='3' points='" & Lines & "'/></svg>", BLANK()) RETURN SVGImageURL4.2KViews0likes7Commentssparkline x-axis Last 10Weeks depending on slicer selection
I am trying to create a sparkline that will only always show last 10 weeks or last 4 quarters depending on what is my Year selection from a slicer. As per checking in the net, I have to create a flexible dynamic table that will be the place holder of selected weeks. I did a formula below but doesn't seem to work as a list of the new column/table. Appreacte any help. Thanks! Quarter format sample = 2022_1 Week format sample = 2020_01 CODE: Top4Q = Var MaxQtr = Maxx(ALLSELECTED(FiscalCalendar),FiscalCalendar[FiscalQuarter]) VAR MinQtr = MaxQtr - 4 Return CALCULATE(SUM(FiscalCalendar[FiscalQuarter]),FiscalCalendar[FiscalQuarter]>=MinQtr && FiscalCalendar[FiscalQuarter]<=MaxQtr)1.6KViews0likes4Comments