Tag Archives: Power BI

Power Query (M-Language) Apply Where Clause to Table DateTime.Now() / GetDate()

If you want to apply a WHERE clause to the Data of a table, for example to limit the result to only valid rows (where GETDATE() between ValidFrom and ValidTo) go to the Advanced Query Editor and add the Table.SelectRows() statement, as follows:

let
    Quelle = Sql.Database("localhost\DWH_DEV", "DWH", [CommandTimeout=#duration(0, 0, 5, 0)]),
    etl_Datastore = Quelle{[Schema="etl",Item="Datastore"]}[Data],
    ds = Table.SelectRows(etl_Datastore, each [ValidFrom] <= DateTime.Date(DateTime.LocalNow()) and [ValidTo] >=DateTime.Date(DateTime.LocalNow()))
in
    ds

Add KPI Symbol to Table Visual in Power BI

If you want to display an Icon within a Table instead of a boolean True/False Text, go ahead and apply the screenshotted solution.

Remember that you have to use a Measure as basement field (Basierend auf Feld). I’ve included an example to the right in the grayed-out rectangle (Anz_Failed = … ).

Possible result may be the following…