visual
74 TopicsPower BI - Deneb visual - Read a JSON to create the visuals
Hi everyone, I have a graphic which work correctly. I use at the moment a table in power BI dedicated for this visual. It seems possible for deneb to read JSON data because when I provide the original table with the JSON column, I can see the data but when I try to use JSON.parse(), I have lot of errors Please find my current code which work perfectly from my Power BI. { "$schema": "https://vega.github.io/schema/vega/v5.json", "description": "Final trusted version with a correctly implemented 'No Schedule Data' message.", "width": 372, "height": 48, "signals": [ { "name": "pbi_time_offset_seconds", "init": "isValid(data('pbi_summarize')[0]) ? data('pbi_summarize')[0].DST_ClockDiffBtwLocationAndLocalOffset : 0" }, { "name": "utc_now", "init": "now()", "on": [ { "events": {"type": "timer", "throttle": 10000}, "update": "now()" } ] }, { "name": "remote_now", "update": "utc_now + (pbi_time_offset_seconds * 1000)" }, { "name": "remote_day", "update": "day(remote_now)" }, { "name": "remote_hour_decimal", "update": "hours(remote_now) + (minutes(remote_now) / 60) + (seconds(remote_now) / 3600)" }, { "name": "remote_time_label", "update": "timeFormat(remote_now, '%H:%M')" }, { "name": "has_data_for_today", "update": "data('daily_schedule').length > 0" } ], "data": [ { "name": "dataset" }, { "name": "pbi_summarize" }, { "name": "daily_schedule", "source": "dataset", "transform": [ {"type": "filter", "expr": "datum.day_num != null && datum.day_num == remote_day"} ] }, { "name": "schedule_bands", "source": "daily_schedule", "transform": [ { "type": "filter", "expr": "datum.ScheduleType == 'Production' || datum.ScheduleType == 'ITSupport'" }, { "type": "formula", "as": "display_type", "expr": "datum.type == 'Normal' ? (datum.ScheduleType == 'Production' ? 'Working hours' : 'Support hours') : datum.type == 'Flexible' ? 'Flexible hours' : 'No Working hours'" } ] }, { "name": "site_opening_start", "source": "daily_schedule", "transform": [ {"type": "filter", "expr": "datum.ScheduleType == 'SiteOpening'"}, {"type": "project", "fields": ["startTime"], "as": ["time_value"]} ] }, { "name": "site_opening_end", "source": "daily_schedule", "transform": [ {"type": "filter", "expr": "datum.ScheduleType == 'SiteOpening'"}, {"type": "project", "fields": ["endTime"], "as": ["time_value"]} ] } ], "scales": [ { "name": "xscale", "type": "linear", "range": "width", "domain": [0, 24] }, { "name": "yscale", "type": "band", "range": [1, 50], "domain": ["ITSupport", "Production"], "padding": 0.1 }, { "name": "color", "type": "ordinal", "domain": ["Working hours", "Support hours", "Flexible hours", "No Working hours"], "range": ["#a6cee3", "#b2df8a", "#1f78b4", "#d3d3d3"] } ], "axes": [ { "orient": "bottom", "scale": "xscale", "tickCount": 25, "title": { "signal": "timeFormat(remote_now, 'Time & Day (%Y-%m-%d)')" }, "labelFontSize": 9, "titleFontSize": 9 } ], "marks": [ { "type": "group", "name": "custom_legend", "encode": {"enter": {"x": {"value": 0}, "y": {"value": -40}}}, "marks": [ {"type": "rect", "encode": {"enter": {"x": {"value": 0}, "y": {"value": 0}, "width": {"value": 10}, "height": {"value": 10}, "fill": {"value": "#a6cee3"}}}}, {"type": "text", "encode": {"enter": {"x": {"value": 15}, "y": {"value": 9}, "text": {"value": "Working hours"}, "fontSize": {"value": 10}, "align": {"value": "left"}}}}, {"type": "rect", "encode": {"enter": {"x": {"value": 120}, "y": {"value": 0}, "width": {"value": 10}, "height": {"value": 10}, "fill": {"value": "#1f78b4"}}}}, {"type": "text", "encode": {"enter": {"x": {"value": 135}, "y": {"value": 9}, "text": {"value": "Flexible hours"}, "fontSize": {"value": 10}, "align": {"value": "left"}}}}, {"type": "rect", "encode": {"enter": {"x": {"value": 240}, "y": {"value": 0}, "width": {"value": 10}, "height": {"value": 10}, "fill": {"value": "#d3d3d3"}}}}, {"type": "text", "encode": {"enter": {"x": {"value": 255}, "y": {"value": 9}, "text": {"value": "No Working hours"}, "fontSize": {"value": 10}, "align": {"value": "left"}}}}, {"type": "rect", "encode": {"enter": {"x": {"value": 0}, "y": {"value": 15}, "width": {"value": 10}, "height": {"value": 10}, "fill": {"value": "#b2df8a"}}}}, {"type": "text", "encode": {"enter": {"x": {"value": 15}, "y": {"value": 24}, "text": {"value": "Support hours"}, "fontSize": {"value": 10}, "align": {"value": "left"}}}}, {"type": "rule", "encode": {"enter": {"x": {"value": 122}, "y": {"value": 13}, "x2": {"value": 122}, "y2": {"value": 23}, "stroke": {"value": "black"}}}}, {"type": "symbol", "encode": {"enter": {"x": {"value": 122}, "y": {"value": 22}, "shape": {"value": "triangle-up"}, "size": {"value": 25}, "fill": {"value": "black"}}}}, {"type": "rule", "encode": {"enter": {"x": {"value": 128}, "y": {"value": 15}, "x2": {"value": 128}, "y2": {"value": 24}, "stroke": {"value": "black"}}}}, {"type": "symbol", "encode": {"enter": {"x": {"value": 128}, "y": {"value": 15}, "shape": {"value": "triangle-down"}, "size": {"value": 25}, "fill": {"value": "black"}}}}, {"type": "text", "encode": {"enter": {"x": {"value": 135}, "y": {"value": 24}, "text": {"value": "Site Opening"}, "fontSize": {"value": 10}, "align": {"value": "left"}}}} ] }, { "type": "text", "interactive": false, "encode": { "enter": { "x": {"field": {"group": "width"}, "mult": 0.5}, "y": {"field": {"group": "height"}, "mult": 0.5}, "text": {"value": "No Schedule Data for Today"}, "fontSize": {"value": 12}, "fontWeight": {"value": "bold"}, "fill": {"value": "gray"}, "align": {"value": "center"} }, "update": { "opacity": [{"test": "has_data_for_today", "value": 0}, {"value": 1}] } } }, { "type": "rect", "from": {"data": "schedule_bands"}, "encode": { "enter": { "x": {"scale": "xscale", "field": "startTime"}, "x2": {"scale": "xscale", "field": "endTime"}, "y": {"scale": "yscale", "field": "ScheduleType"}, "height": {"scale": "yscale", "band": 1}, "fill": {"scale": "color", "field": "display_type"} }, "update": { "opacity": [{"test": "has_data_for_today", "value": 1}, {"value": 0}] } } }, { "type": "rule", "from": {"data": "site_opening_start"}, "encode": { "enter": {"x": {"scale": "xscale", "field": "time_value"}, "y": {"value": 0}, "y2": {"value": 50}, "stroke": {"value": "black"}, "strokeWidth": {"value": 2}}, "update": {"opacity": [{"test": "has_data_for_today", "value": 1}, {"value": 0}]} } }, { "type": "symbol", "from": {"data": "site_opening_start"}, "encode": { "enter": {"x": {"scale": "xscale", "field": "time_value"}, "y": {"value": 50}, "shape": {"value": "triangle-up"}, "size": {"value": 50}, "fill": {"value": "black"}}, "update": {"opacity": [{"test": "has_data_for_today", "value": 1}, {"value": 0}]} } }, { "type": "rule", "from": {"data": "site_opening_end"}, "encode": { "enter": {"x": {"scale": "xscale", "field": "time_value"}, "y": {"value": 0}, "y2": {"value": 50}, "stroke": {"value": "black"}, "strokeWidth": {"value": 2}}, "update": {"opacity": [{"test": "has_data_for_today", "value": 1}, {"value": 0}]} } }, { "type": "symbol", "from": {"data": "site_opening_end"}, "encode": { "enter": {"x": {"scale": "xscale", "field": "time_value"}, "y": {"value": 3}, "shape": {"value": "triangle-down"}, "size": {"value": 50}, "fill": {"value": "black"}}, "update": {"opacity": [{"test": "has_data_for_today", "value": 1}, {"value": 0}]} } }, { "type": "rule", "encode": { "update": { "x": {"scale": "xscale", "signal": "remote_hour_decimal"}, "y": {"value": 2}, "y2": {"value": 50}, "stroke": {"value": "red"}, "strokeWidth": {"value": 2} } } }, { "type": "text", "encode": { "update": { "x": {"scale": "xscale", "signal": "remote_hour_decimal"}, "y": {"value": 3}, "text": {"signal": "remote_time_label"}, "baseline": {"value": "bottom"}, "align": {"value": "center"}, "fill": {"value": "red"} } } } ] } Please find an example of my JSON file stored in Sharepoint (Text multi-lines) {"schedule_rules":[{"day_num":"0","segments":[{"approval_needed":null,"communication_needed":"Mandatory","end_time":"23:59","start_time":"00:00","type":"No Production"}]},{"day_num":"1","segments":[{"approval_needed":"Yes","communication_needed":null,"end_time":"12:30","start_time":"08:30","type":"Normal"},{"approval_needed":"Yes","communication_needed":null,"end_time":"16:30","start_time":"13:30","type":"Normal"}]},{"day_num":"2","segments":[{"approval_needed":"Yes","communication_needed":null,"end_time":"12:30","start_time":"08:30","type":"Normal"},{"approval_needed":"Yes","communication_needed":null,"end_time":"16:30","start_time":"13:30","type":"Normal"}]},{"day_num":"3","segments":[{"approval_needed":"Yes","communication_needed":null,"end_time":"12:30","start_time":"08:30","type":"Normal"},{"approval_needed":"Yes","communication_needed":null,"end_time":"16:30","start_time":"13:30","type":"Normal"}]},{"day_num":"4","segments":[{"approval_needed":"Yes","communication_needed":null,"end_time":"12:30","start_time":"08:30","type":"Normal"},{"approval_needed":"Yes","communication_needed":null,"end_time":"16:30","start_time":"13:30","type":"Normal"}]},{"day_num":"5","segments":[{"approval_needed":"Yes","communication_needed":null,"end_time":"12:30","start_time":"08:30","type":"Normal"},{"approval_needed":"Yes","communication_needed":null,"end_time":"16:30","start_time":"13:30","type":"Normal"}]},{"day_num":"6","segments":[{"approval_needed":null,"communication_needed":"Mandatory","end_time":"23:59","start_time":"00:00","type":"No Production"}]}]} How to import this JSON in Deneb ? I tried with JSON.parse but fails each time Thank you for your supportSolvedCreate a Matrix that has 3,6,12 month averages of measures
This picture showcases the end goal (sorry i dont have a better example) that i am trying to acheive. I do have a calender table and all the measures but cant seem to find how to achieve this for the matrix visual. Please reach out with any knowldege on this!Solved1KViews0likes5CommentsAdd Extensible Excel Style "Custom Combo Chart" to Power BI
I would like to suggest the addition of an extensible "Excel Style Combo Chart" feature to Power BI. This feature would allow users to create highly customizable combo charts, similar to those available in Excel. Key functionalities should include: Multiple Series Types: Enable users to add multiple series of any type (e.g., columns, bars, stacked, area, lines, points) within a single chart. Overlay, Order, Opacity: Allow users to overlay different visual types, control the order of series, and adjust the series' opacity to achieve the desired visual effect. Custom Formatting: Provide extensive customization options for each series, including colors, line styles, borders, transparency, markers, and more. This feature would greatly enhance the flexibility and functionality of Power BI visualizations, allowing users to create more complex and informative charts tailored to their specific needs. Indeed, I think if the "Custom Combo Chart" was done well it would eliminate the need to create so many various single purpose charts. Thank you for considering this suggestion.1.1KViews0likes0CommentsGetting a sum of a percentage in my visual instead of an average for the week
Hello, I am trying to get a visual that shows 3 things: Average of % reservation of an office per week, Average of % presence of an office per week, Max % presence of an office within the week. Right now I've been doing the percentage, for both reservation and presence, using a measure. But when I add it to a visual, I get the sum of every % instead of the average of each day in the week. Maybe the method I use isn't the proper one Table Reservation Name Email Office Date John Smith [email protected] A1 10-Oct-24 John Smith [email protected] A1 11-Oct-24 Bob Loblaw [email protected] A3 10-Oct-24 Table Presence Name Email Office Date John Smith [email protected] A1 10-Oct-24 John Smith [email protected] A1 11-Oct-24 Bob Loblaw [email protected] A3 10-Oct-24 Bob Loblaw [email protected] A2 11-Oct-24 Table Reservable Offices Office Reservable A1 TRUE A2 TRUE A3 TRUE A4 FALSE Measures Total amount of reservable office = CALCULATE(COUNT('Total amount of reservable office'[Office]), ('Total amount of reservable office'[Reservable]="True")) %Reservation = CALCULATE((COUNT('Reservation'[Name]))/([Total amount of reservable office])) Can you help out a newby? Also, when I right click on the measure in my Y Axis, I don't see the options to change the agreggation to AVG instead of sum.Solved900Views0likes3Commentscreate area chart with green and red colors to indicate profit and loss
I have created area chart that that shows profit and loss % over time. I would like to show the loss (negative part) in red color and the profit ( positive part) in geen color. i created 2 measures one for profit % and one for loss % positive p&l = var pl=[p&l %] var result= IF(pl>0 , pl,0) return result negative p&l = var pl=[p&l %] var result= IF(pl<0 , pl,0) return result when i added the measures in the chart it looked like: any idea on how to create the area chart with green/red colors instead of 1 color1.3KViews0likes2CommentsUpdate line chart with dash-by / shape-by functionality
We've the ability to color (colorby) data series in a line chart using the Legend option in Power BI, but we still don't have the option to "dash by" to determine the shape of the line by another field. This is pretty basic functionality in most of python plotting librires for example. I am trying to port our solution from Dash plotly very hard but limitations like this make using PBI questionable to be frank. What could be an alternative to distinguish the data set based on two “legend” fileds and not on single one? I am proposing an idea to Microsoft to help us differentiate between our data based on another "legend" field.1.1KViews0likes0CommentsChange visual sort from years to months when a specific year is chosen
Greetings everyone, First of all, I'm glad to be here and become a member of this community, I have always been a visitor haha. I have a visual (Area Chart) that shows the expenses for the past 3 years by years (2022,2023,2024) and I have a slicer that filter the years. But when you choose 2023, the visual shows nothing because it's Data Hierarchy by years. How can I make visual to changes automatically from years to months when a specific year is chosen ? Thank you in advance !Solved668Views0likes1CommentFigma Custom Visual - Possible plugin
Hey there! I've got an exciting idea to share with you all. How about creating a Figma custom visual exclusively for Power BI? Microsoft already has a Figma API for Power Apps, so the groundwork is there. Picture this: we'd seamlessly import Figma wireframes or components right into Power BI with sick UI in PNG or SVG files (if that's doable). And to take things up a notch, let's make sure it supports importing component variants like hover, selected, focused, disabled – you name it – complete with their font and colour hex codes. Trust me, this would be an absolute dream and a total game-changer for designing in Power BI! Let's make it happen, team!4.4KViews8likes1CommentDAX Measure not respecting filter context in powerBI visual
Context: In Power BI, I want to create custom labels for my budget values. Currently, I'm using the following DAX measure: label_Budget = VAR BudgetAmount = [Budget_amount_total_no_Scope] RETURN CALCULATE(SWITCH( TRUE(), BudgetAmount > 0 && BudgetAmount < 1000, "€0", BudgetAmount >= 1000 && BudgetAmount < 100000, "€0,.0K", BudgetAmount >= 100000 && BudgetAmount < 1000000, "€0,.K", BudgetAmount >= 1000000, "€0,,.#M") , ALLSELECTED()) My [Budget_amount_total_no_Scope] measure is defined as: Budget_amount_total_no_Scope = SUM(daily_budget) Issue: The issue I'm facing is that the criteria in the label_Budget measure are applied to the total budget values, not per channel. As a result, a channel with a budget less than €1,000,000 gets the same label as a channel with a budget greater than €1,000,000 because the criteria are not applied individually to each channel. Objective: I want to modify my measure so that for every selected hierarchy level, the individual channel values are evaluated against the criteria in label_Budget. Could someone help me adjust this measure so that it correctly applies the criteria at each individual channel level? Any guidance or suggestions would be greatly appreciated.429Views0likes1Comment