This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi I am trying to create a custom visual , my ts script is this:
but it fails me, the only thing I want is that the user when he clicks sends OK to the semantic model of the pbi.
help!!!
@jesuslogmein Hi! Try with:
import powerbi from "powerbi-visuals-api";
import IVisual = powerbi.extensibility.visual.IVisual;
import VisualConstructorOptions = powerbi.extensibility.visual.VisualConstructorOptions;
import IVisualHost = powerbi.extensibility.visual.IVisualHost;
import VisualUpdateOptions = powerbi.extensibility.visual.VisualUpdateOptions;
import { FilterAction, FilterType, IBasicFilter } from "powerbi-models";
export class Visual implements IVisual {
private target: HTMLElement;
private host: IVisualHost;
constructor(options: VisualConstructorOptions) {
this.target = options.element;
this.host = options.host;
// Add a button to send "OK" filter
this.target.innerHTML = `<button id="btnSendOk">Validación</button>`;
const btn = this.target.querySelector("#btnSendOk") as HTMLButtonElement;
btn.addEventListener("click", () => this.sendOkToModel());
}
sendOkToModel() {
const filter: IBasicFilter = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "tb_llamadas",
column: "transcription_items.transcription_time"
},
operator: "In",
values: ["OK"],
filterType: FilterType.Basic
};
this.host.applyJsonFilter(
filter,
"general", // objectName — can be any string
"filter", // propertyName — must be a string
FilterAction.merge // This is the correct enum
);
console.log("Filtro 'OK' aplicado");
}
update(options: VisualUpdateOptions) {
// Not used for this button-only visual
}
}
BBF
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 |