formatting
45 TopicsDynamic formatting not showing the correct currency in Excel
Hi team, I am using the dynamic formatting for a switch measure to ensure to display the data in correct format according to the selected measure. It works all fine until I visualise the data in Excel. I get £ sign instead of $ sign. Here is the dynamic formatting code: SWITCH( TRUE(), [SelectedMeasure] = 1, "$#,##0", // Revenue [SelectedMeasure] = 2, "#,##0", // Units [SelectedMeasure] = 3, "#,##0", // Accounts [SelectedMeasure] = 4, "$#,##0", // ADS Revenue [SelectedMeasure] = 5, "#,##0", // ADS Units [SelectedMeasure] = 6, "$#,##0", // Revenue On Pace [SelectedMeasure] = 7, "#,##0", // Units On Pace [SelectedMeasure] = 8, "$#,##0", // ASP [SelectedMeasure] = 9, "#,##0", // Units / Account [SelectedMeasure] = 11, "0%", // IVL/PCI% [SelectedMeasure] = 12, "0%", // IVL/ROTA% [SelectedMeasure] = 13, "$#,##0", // Revenue (actual fx) [SelectedMeasure] = 14, "#,##0", // Units Coronary [SelectedMeasure] = 15, "#,##0", // Units Peripheral [SelectedMeasure] = 16, "#,##0", // Orders [SelectedMeasure] = 18, "$#,##0", // Revenue Coronary [SelectedMeasure] = 19, "$#,##0", // Revenue Peripheral [SelectedMeasure] = 20, "#,##0", // Units FOC [SelectedMeasure] = 21, "0%", // Units FOC % [SelectedMeasure] = 22, "0%", // C2/PCI% [SelectedMeasure] = 23, "0%", // C2/ROTA% "General" // Default format ) I tried adding FORMAT([SelectedMeasure]) but it returns wrong results. Kindly advise, Best regards, HugoSolved1.2KViews0likes2CommentsHelp with Formatting a Matrix with Multiple Hierarchical Levels in Power BI
Hello everyone, I am working on a Power BI report that uses a matrix with 10 hierarchical levels to display my financial data. My goal is to create a P&L (Profit and Loss) presentation where data at lower levels aggregates correctly to higher levels. However, I am facing a sorting issue: for example, I find the "Profit Before Tax" appearing at the top, while I would like to reorganize it so that it fits properly within the structure of my P&L (exemple here) Here are a few specific points where I would appreciate your help: Custom Sorting: How can I define a specific sort order for my hierarchical levels so that they display in the desired order? Data Aggregation: Is there a method to ensure that values aggregate correctly at each hierarchical level? Matrix Formatting: What are the best practices for formatting a matrix with so many levels to ensure optimal readability? Thank you in advance for your help and suggestions. Any advice or resources would be greatly appreciated! Best regards,Apply formatting based on previous column value
I need to change background on matrix fields if the "next" phase has a value. I have data as shown, each item has a score for 3 tests. The tests are done 3 times, once for each phase. If any item completes tests in Phase 2 or 3 with no score in Phase 1 then I need to color phase 1 red as missing. Item TEST Score Phase Item1 A 2 1 Item1 A 1 2 Item1 A 3 3 Item1 B 2 1 Item1 B 1 2 Item1 B 3 3 Item1 C 2 1 Item1 C 1 2 Item1 C 3 3 Item2 A 1 2 Item2 A 3 3 Item2 B 1 2 Item2 B 3 3 Item2 C 1 2 Item2 C 3 3 Expected Output - Where it says RED it should be blank with a red background. Phase and Test are column headers Phase 1 1 1 2 2 2 3 3 3 TEST A B C A B C A B C Item1 2 2 2 1 1 1 3 3 3 Item2 RED RED RED 1 1 1 3 3 3 So I need a way to know, Am I in phase 1A and does phase 2A have a score. Not sure how I write this? Any help or just pointing me where to start would be great.Solved1.6KViews1like7CommentsMatrix Format Changes When Published to Power BI Report Server
We recently upgraded to May 2024 for Power BI Report Server and we're running into a very weird problem. Maxtrixes are not allowing us to use the Tabular or Outline formatting when published. They loook fine in desktop, but once on the server, they look like the default Matrix layout. Example Below: How it looks in desktop: How it looks on the Server: This is the desktop software version: And this is the RS version: Please help! This is driving us crazy!Solved1.4KViews0likes3CommentsProblem with formatting and series
Hi everyone, I'm developing a PowerBI custom visual to draw time series differentiated by a legend. The problem I'm having is with formatting settings. What I would like is to have a colorPicker in my formatting pane for each of my series. Here's what I've already done: - I created a "colorSelector" object in capabilities.json that will be a Slice for each series colorPicker - I created a selection for each series using this documentation (Create selections for series) - I used colorHelper to set the default color for series with colorPalette or find the color of the “colorSelector” object associated with a serie, based on this documentation - I populated the pane formatting based as much as possible on the barChat example github I manage to get something but the behavior is bizarre: - There's a colorPicker for each different series BUT when I change the color, it instantly reverts to its default value. I think I'm missing some information so that I can properly assign a color to each series and then retrieve them, but I haven't been able to find a solution for several days. Here's what I think The colorHelper can't find the color associated to the object but I tried to find the color in a manual way and there is the same result There is a problem with the selection, maybe I'm doing it wrong? populateColorSelector is not implemented properly? I'm not creating the data properly? (dataSeries) I'd like to thank anyone who can help me understand the problem I encounter. Here is the code: capabilities.json { "dataRoles": [ { "displayName": "Categories", "name": "category", "kind": "Grouping" }, { "displayName": "Measures", "name": "measure", "kind": "Measure" }, { "displayName": "Series", "name": "series", "kind": "Grouping" } ], "objects": { "colorSelector": { "properties": { "fill": { "type": { "fill": { "solid": { "color": true } } } } } } }, "dataViewMappings": [ { "categorical": { "categories": { "for": { "in": "category" } }, "values": { "group": { "by": "series", "select": [{ "for": { "in": "measure" } } ] } } } } ], "privileges": [] } settings.ts: "use strict"; import { formattingSettings } from "powerbi-visuals-utils-formattingmodel"; import { dataSerie } from "./visual"; import FormattingSettingsCard = formattingSettings.SimpleCard; import FormattingSettingsSlice = formattingSettings.Slice; import FormattingSettingsModel = formattingSettings.Model; import ColorPicker = formattingSettings.ColorPicker; class ColorSelectorCardSettings extends FormattingSettingsCard { name: string = "colorSelector"; displayName: string = "Data Colors"; slices: FormattingSettingsSlice[] = []; } export class VisualFormattingSettingsModel extends FormattingSettingsModel { colorSelector = new ColorSelectorCardSettings(); cards: FormattingSettingsCard[] = [this.colorSelector]; populateColorSelector(dataPoints: dataSerie[]) { const slices: FormattingSettingsSlice[] = this.colorSelector.slices; if (dataPoints) { dataPoints.forEach(dataPoint => { slices.push(new ColorPicker({ name: "fill", displayName: dataPoint.value.toString(), value: { value: dataPoint.color }, selector: dataPoint.selection.getSelector(), })); }); } } } visual.ts: "use strict"; import powerbi from "powerbi-visuals-api"; import { FormattingSettingsService } from "powerbi-visuals-utils-formattingmodel"; import { ColorHelper } from "powerbi-visuals-utils-colorutils"; import "./../style/visual.less"; import VisualConstructorOptions = powerbi.extensibility.visual.VisualConstructorOptions; import VisualUpdateOptions = powerbi.extensibility.visual.VisualUpdateOptions; import IVisual = powerbi.extensibility.visual.IVisual; import ISelectionId = powerbi.visuals.ISelectionId; import IVisualHost = powerbi.extensibility.visual.IVisualHost; import IColorPalette = powerbi.extensibility.IColorPalette; import DataViewValueColumns = powerbi.DataViewValueColumns; import DataViewValueColumnGroup = powerbi.DataViewValueColumnGroup; import DataViewObjectPropertyIdentifier = powerbi.DataViewObjectPropertyIdentifier; import ILocalizationManager = powerbi.extensibility.ILocalizationManager; import { VisualFormattingSettingsModel } from "./settings"; export interface dataSerie { value: powerbi.PrimitiveValue; selection: ISelectionId, color: string; } export class Visual implements IVisual { private formattingSettings: VisualFormattingSettingsModel; private formattingSettingsService: FormattingSettingsService; private host: IVisualHost; private colorPalette: IColorPalette; private localizationManager: ILocalizationManager; constructor(options: VisualConstructorOptions) { this.host = options.host; this.localizationManager = this.host.createLocalizationManager(); this.formattingSettingsService = new FormattingSettingsService(this.localizationManager); this.colorPalette = options.host.colorPalette; } public update(options: VisualUpdateOptions) { this.formattingSettings = this.formattingSettingsService.populateFormattingSettingsModel(VisualFormattingSettingsModel, options.dataViews?.[0]); const dataSeries: dataSerie[] = []; const series: powerbi.DataViewValueColumnGroup[] = options.dataViews[0].categorical.values.grouped(); const valueColumns: DataViewValueColumns = options.dataViews[0].categorical.values, grouped: DataViewValueColumnGroup[] = valueColumns.grouped(), defaultDataPointColor: string = "green", fillProp: DataViewObjectPropertyIdentifier = { objectName: "objectName", propertyName: "propertyName" }; series.forEach((ser: powerbi.DataViewValueColumnGroup, index) => { // create selection id for series const seriesSelectionId = this.host.createSelectionIdBuilder() .withSeries(options.dataViews[0].categorical.values, ser) .createSelectionId(); // get the color from series const defaultDataPointColor: string = this.colorPalette.getColor(ser.name.toString()).value; let colorHelper: ColorHelper = new ColorHelper( this.colorPalette, fillProp, defaultDataPointColor); let grouping: DataViewValueColumnGroup = grouped[index]; let color = colorHelper.getColorForSeriesValue(grouping.objects, grouping.name); // create the series elements dataSeries.push({ value: ser.name, selection: seriesSelectionId, color: color }); }); // Populate the formatting pane this.formattingSettings.populateColorSelector(dataSeries); } public getFormattingModel(): powerbi.visuals.FormattingModel { return this.formattingSettingsService.buildFormattingModel(this.formattingSettings); } } Sample of data: X Y Legend samedi 30 décembre 2023 14022,91642 C dimanche 31 décembre 2023 0,551076646 A dimanche 31 décembre 2023 10435,26002 C lundi 1 janvier 2024 0,689471555 A lundi 1 janvier 2024 12759,20759 C mardi 2 janvier 2024 0,305575341 A mardi 2 janvier 2024 10230,89312 C mercredi 3 janvier 2024 0,587809939 A mercredi 3 janvier 2024 11722,69859 C jeudi 4 janvier 2024 0,964788095 A jeudi 4 janvier 2024 13221,84671 C vendredi 5 janvier 2024 0,721572695 A vendredi 5 janvier 2024 11472,99755 C samedi 6 janvier 2024 0,394463782 A samedi 6 janvier 2024 43840,72009 B samedi 6 janvier 2024 11982,3041 C samedi 6 janvier 2024 515,2744629 D samedi 6 janvier 2024 694,6464676 E dimanche 7 janvier 2024 0,359213967 A dimanche 7 janvier 2024 46322,50275 B dimanche 7 janvier 2024 14065,89778 C dimanche 7 janvier 2024 279,9718025 D dimanche 7 janvier 2024 653,0402894 E And how I fill the data fields:Solved1.3KViews0likes1CommentHow can I add Groups using Formatting model utils to build a formatting settings model?
Hi there! I use Formatting model utils to build a formatting settings model to populate the property panes. There are models, cards, and slices. I have relations as "Model -> Cards -> Slices". I want to add Groups and then it should look like "Model -> Cards -> Groups -> Slices". I found some information about the Formatting group here and I found an example of how to generate groups using "getFormattingModal" here. Then I should use getFormattingModal for all my formatting settings and I don't want it, because it is not convenient. So, how can I add groups to the formatting model using "Formatting group" instead of "getFormattingModal"? I need something like this:2KViews2likes3CommentsUsing JSON to Format Text Boxes
I'm running into an issue when trying to edit the JSON file for my powerBI report. I have a solid file, however, I am unable to edit the formatting for text boxes in the file. I found a solution from 2021. However, it seems to no longer work with the 8/2023 version of PowerBI. Would anyone have a code snippet they are willing to share? "textbox": { "*": { "*": [ { "fontSize": 14, "fontface": "Arial", "color": "#333333" } ], }}Need help with a DAX measure issue, that doesn't filter correctly.
hi Guys/Girls I've got a measure [FilteredTotal] & [Total], and i'd like to create a measure that returns the value from [Total] when the filter is active on the page, or else if filte is not active return the value for [FilteredTotal]. ConditionalTotal = IF ( ISFILTERED(ChartOfAccounts[Name]), [Total], [FilteredTotal] ) but this doesn't really work, because the value for [Total] still shows when no filter is chosen. what might be the problem? please ask if you need more info to answer/help965Views0likes5CommentsPublishing to report server changes subtotal column formatting. May 2022 version
When I view / edit on desktop, the formatting works as expected with the colors being uniform. When I publish to the report server, I lose the background color for the subtotal rows. The font color is assigned white, and that is normal, but the background color changes to the alternating grey / white 'default' style instead of maintaining the default color assignment.302Views0likes0Comments