Forum Discussion

zvm's avatar
zvm
Icon for Helper II rankHelper II
8 years ago
Solved

Display measures in rows with columns as time intelligence measures

Hi,   I would like to display measures in rows. That is clear how to do it if columns are "normal" dimensions. But I want following columns (for all chosen measures) : Col 1: day (or date) value ...
  • zvm's avatar
    zvm
    8 years ago

    Hi Dale,

     

    What I meant, everything are actuals for measures in rows. MEasures are Quantity, Sales etc. And columns are actual value for those measures for a single day, for month-do-date, for year-to date, for last year . I.e time intelligence functions of basic measures.

    Here is the example:

    Date (in Slicer)8.3.2018.    
          
     Date actualMonth-to-date actualMTD last year actualYear-to-date actualYTD last year actual
    Quantity5035035831203189
    Sales500378540003128932568
    Costs300245226001786219252
    Margin200133314001342713316

     

    I think I solved it. 

    I created auxilirary table with measure names (Table is 'Popis mjera'; column name is [Naziv mjere]; column values (actual measure names) are Prodaja, SL_prodaja etc)

    And then several new measures with switch.

    Here is an example:

    Realizacija = SWITCH(TRUE();
                         CALCULATETABLE(VALUES('Popis mjera'[Naziv mjere]); 'Popis mjera'[Naziv mjere] = "Prodaja") = "Prodaja" ; [Prodaja];
                         CALCULATETABLE(VALUES('Popis mjera'[Naziv mjere]); 'Popis mjera'[Naziv mjere] = "Slobodna prodaja") = "Slobodna prodaja" ; [Sl_Prodaja];
                         CALCULATETABLE(VALUES('Popis mjera'[Naziv mjere]); 'Popis mjera'[Naziv mjere] = "Receptna prodaja") = "Receptna prodaja" ; [Rec_Prodaja];
                         CALCULATETABLE(VALUES('Popis mjera'[Naziv mjere]); 'Popis mjera'[Naziv mjere] = "Doplata RX") = "Doplata RX" ; [Doplata RX];
                         CALCULATETABLE(VALUES('Popis mjera'[Naziv mjere]); 'Popis mjera'[Naziv mjere] = "Ostala prodaja") = "Ostala prodaja" ; [Ostala prodaja]
                        )

    Measure and table names are in Croatian, but I believe you'll get the clue :)

    I created measures for YTD, LY and repeated SWITCH with corresponding measures. It works.

    Two questions though:

    1. is it possible to solve it easier, simpler? I mean on a calculatetable part. I wanna extract one value from 'Popis mjera' table.

    2. What if one measure does not exist for a chosen period (whole row returns blanks) and I still wanna show 0 instead in that row? I know I can test whole Switch on ISBLANK(), but that would be rather awkward formula.

     

    Many thanks.

     

    Zrinko