Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Set values in a visual (table visual) from 2 different model of table

Greeting all ,  i have the following tables as my data source (Live connection with a cube ) (1: table with current values , and a table with historic values )

Ex --First table (Historique )  :    

KPI nameValueMonth name
KPI A 10mars 
KPI A 15avril
KPI A 20mai
KPI B1mars 
KPI B5avril
KPI B2mai
KPI C100mars 
KPI C200avril
KPI C300mai

 

table with the Current values ( Current and last months ) 

KPI A KPI B KPI C KPI X Month 
25940020June
30350025July
   15May
   10April
   5Mars

=> what im trying to make is a table with those values (Both historic and current ) : 

Objective :  Table Overview : 

 Mars Aprilmay June July
KPI A 1015202530
KPI B15293
KPI C100200300400500
KPI X510152025

 

 

So please How can i  create the table overview using the historic and the current table (the KPI X doesnt exist in the historic table ) Thanks in advance community !  

1 ACCEPTED SOLUTION
v-zhenbw-msft
Community Support
Community Support

Hi @Anonymous ,

 

The live connection mode cannot enter data and create a calculate table. And this issue cannot use one measure to achieve.

So you need to add a table as follows in the data source. Please be careful not to build a relationship.

 

set1.jpg

 

Then we can create a measure and build the matrix table like this,

 

Measure = 
VAR _table1 =
    SELECTCOLUMNS (
        'Current',
        "KPI", "KPI A",
        "value", CALCULATE ( SUM ( 'Current'[KPI A] ) ),
        "Month", 'Current'[Month]
    )
VAR _table2 =
    SELECTCOLUMNS (
        'Current',
        "KPI", "KPI B",
        "value", CALCULATE ( SUM ( 'Current'[KPI B] ) ),
        "Month", 'Current'[Month]
    )
VAR _table3 =
    SELECTCOLUMNS (
        'Current',
        "KPI", "KPI C",
        "value", CALCULATE ( SUM ( 'Current'[KPI C] ) ),
        "Month", 'Current'[Month]
    )
VAR _table4 =
    SELECTCOLUMNS (
        'Current',
        "KPI", "KPI X",
        "value", CALCULATE ( SUM ( 'Current'[KPI X] ) ),
        "Month", 'Current'[Month]
    )
VAR _new_table =
    FILTER ( UNION ( _table1, _table2, _table3, _table4 ), [value] <> BLANK () )
VAR _table =
    UNION ( _new_table, HIS )
VAR _result =
    SUMX (
        FILTER (
            _table,
            [KPI] = MAX ( 'Table'[KPI] )
                && [Month] = MAX ( 'Table'[Month] )
        ),
        [value]
    )
RETURN
    _result

 

set2.jpg

 

Live Connection has many limitations, we recommend that you process your data at the data source.

 

If you have any question, please kindly ask here and we will try to resolve it.

 

Best regards,

 

Community Support Team _ zhenbw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

BTW, pbix as attached.

View solution in original post

5 REPLIES 5
v-zhenbw-msft
Community Support
Community Support

Hi @Anonymous ,

 

The live connection mode cannot enter data and create a calculate table. And this issue cannot use one measure to achieve.

So you need to add a table as follows in the data source. Please be careful not to build a relationship.

 

set1.jpg

 

Then we can create a measure and build the matrix table like this,

 

Measure = 
VAR _table1 =
    SELECTCOLUMNS (
        'Current',
        "KPI", "KPI A",
        "value", CALCULATE ( SUM ( 'Current'[KPI A] ) ),
        "Month", 'Current'[Month]
    )
VAR _table2 =
    SELECTCOLUMNS (
        'Current',
        "KPI", "KPI B",
        "value", CALCULATE ( SUM ( 'Current'[KPI B] ) ),
        "Month", 'Current'[Month]
    )
VAR _table3 =
    SELECTCOLUMNS (
        'Current',
        "KPI", "KPI C",
        "value", CALCULATE ( SUM ( 'Current'[KPI C] ) ),
        "Month", 'Current'[Month]
    )
VAR _table4 =
    SELECTCOLUMNS (
        'Current',
        "KPI", "KPI X",
        "value", CALCULATE ( SUM ( 'Current'[KPI X] ) ),
        "Month", 'Current'[Month]
    )
VAR _new_table =
    FILTER ( UNION ( _table1, _table2, _table3, _table4 ), [value] <> BLANK () )
VAR _table =
    UNION ( _new_table, HIS )
VAR _result =
    SUMX (
        FILTER (
            _table,
            [KPI] = MAX ( 'Table'[KPI] )
                && [Month] = MAX ( 'Table'[Month] )
        ),
        [value]
    )
RETURN
    _result

 

set2.jpg

 

Live Connection has many limitations, we recommend that you process your data at the data source.

 

If you have any question, please kindly ask here and we will try to resolve it.

 

Best regards,

 

Community Support Team _ zhenbw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

BTW, pbix as attached.

Anonymous
Not applicable

Thank you so much !  it works ! 

 

i find another trick with  Dax to implement the table using the IF function : 

 

Measure = if(Month(ENDOFMONTH(DimDate[Date])) = month(today())  , -get values from current table-  ,  calculate (Values from historic table) 
 
i need for this a dimension table . after ,  all i need to do is to set the Month year and measure in one table .
az38
Community Champion
Community Champion

@Anonymous 

hi

try this technique https://stackoverflow.com/questions/50213905/is-it-possible-to-unpivot-in-power-bi-using-dax


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
v-zhenbw-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can unpivot Current table and append the current table and history table to meet your requirement.

 

1. Select month column and unpivot other columns.

 

set1.jpg

 

2. Then we need to change the column name, because append function needs two tables have the same column name.

 

set2.jpg

 

set3.jpg

 

3. At last we append two tables and create a matrix table to get the result.

 

set4.jpg

 

set5.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

BTW, pbix as attached.

Anonymous
Not applicable

Thank you so much for your explanation but as i mention in the first line the mode of connection is in live mode with a cube , so i cant use the unpivot method . 

 

is there a Dax funtion that can do the unpivot method ? 

 

Thanks in advance 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.