powerbipower-bi-report-server

Using measured value as x-axis


i am using PowerBI Desktop Report-Server.

I have a product table where different device type are stored with it serial number. In the given case the serial numbers aren't unique. That means that each serial number can be used for device type. My issue is that I have to build serial number bins where the user can change the size. The user also change the count of bins.

Product table

With a measure I can calculate the bin number for each serial number.

Bin = floor((maxx(Product, Product[SN])  ) / [selectedBinSize], 1) + 1

Now I wanna show a stacked column chart with the bins (sn-ranges) but I find no way to use the measuerd bin values as x-axis.

Looklike for target target (created with PowerBI Desktop (NOT Resport Server Version)

All articles say that this will not work, but maybe there is a hidden way. Since I realized a solution with power bi (which can't be used!) using parameters (bound to slicer value of bin size and count), but power bi report server do not support parameters. Please let me know when you know a way.

Warm regards


Solution

  • Caveat, I am not familiar with Power BI Report Server, but this solution should work in Power BI Desktop.

    1. Create a table unrelated to any other with a list of your bins.

    2. Create a measure to perform the logic you are wanting across the bins and product combinations.

    Bins

    [Bin]   |[Bin Size]
    --------+----------
    1234    |5         
    

    Measure

    SUMX(
        Bins,
        SUMX(
            FILTER(
                Product,
                FLOOR( DIVIDE( Product[SN] / Bin[BinSize], 1) + 1 = Bins[Bin]
            ),
            Product[SN]
        )
    )
    

    This will give return all serial numbers in the selected bin. It iterates through each bin and product, and only aggregates SN where the logic is true. Here I assumed [selectedBinSize] is referencing a bin attribute column (Bins[Bin]). You may need to tweak based on your environment, but this is the basic approach to this type of problem (dynamic binning).