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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
shareezsaleem
Helper III
Helper III

Convert data in to dynamic summarized data

Hi All,

 

Assume, I have table with below like below in Power BI.

DateParticulars Value Year

1-Jan-2021Beginning_# Contracts9822021
1-Jan-2021Expired_# Contracts-972021
1-Jan-2021New_# Contracts1322021
1-Jan-2021Total Active_# Contracts10172021
1-Feb-2021Beginning_# Contracts10172021
1-Feb-2021Expired_# Contracts-942021
1-Feb-2021New_# Contracts742021
1-Feb-2021Total Active_# Contracts9972021

 

I have 2 slicers, Month & Year (Calendar Table connected to the above table)

I need to have a summarized table (dynamic) based on the selection made on the slicers.

If I select Year 2021 and month Jan & Feb, I need to see the data like below:

Beginning_# Contracts982
Expired_# Contracts-191
New_# Contracts206
Total Active_# Contracts997


This is for creating Waterfall Chart

 

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

Hi, @shareezsaleem ;

Is your problem solved?? If so, Would you mind accept the helpful replies as solutions? In addition, you also could create a measure as follow:

newvalue = 
SWITCH(MAX('Table'[Attribute]),
            "Beginning_# Contracts",CALCULATE(SUM('Table'[Value]),FILTER('Table',EOMONTH([Period],0)=EOMONTH(MIN('Date'[Period]),0))),
            "Total Active_# Contracts",CALCULATE(SUM('Table'[Value]),FILTER('Table',EOMONTH([Period],0)=EOMONTH(MAX('Date'[Period]),0)))
            ,SUM([Value]))

The final output is shown below:

vyalanwumsft_0-1646363472366.png


Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-yalanwu-msft
Community Support
Community Support

Hi, @shareezsaleem ;

Is your problem solved?? If so, Would you mind accept the helpful replies as solutions? In addition, you also could create a measure as follow:

newvalue = 
SWITCH(MAX('Table'[Attribute]),
            "Beginning_# Contracts",CALCULATE(SUM('Table'[Value]),FILTER('Table',EOMONTH([Period],0)=EOMONTH(MIN('Date'[Period]),0))),
            "Total Active_# Contracts",CALCULATE(SUM('Table'[Value]),FILTER('Table',EOMONTH([Period],0)=EOMONTH(MAX('Date'[Period]),0)))
            ,SUM([Value]))

The final output is shown below:

vyalanwumsft_0-1646363472366.png


Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thejeswar
Resident Rockstar
Resident Rockstar

Hi @shareezsaleem ,

Not sure what your requirement here is.

 

From the expected output I see, two particulars are summing up Jan and Feb values while the other values show the Jan values alone

 

You can just get this without even building a summary table. Below is the screenshot

Thejeswar_0-1646133114463.png

 

Thejeswar_1-1646133138876.png

Regards,

 

Yeah Thejeswar, I agree. The need can be achieved by simple drag and drop. Because as we drop in the "Values" field of visualization, Power BI automatically sums/aggregate the value column by creating implicit measures.

I need to create a waterfall chart from the below and visual should change based on the Year and Month Slicers. If I select 2021 and month as Mar, Apr, May- it should show be the contract at the begining as the March's number, Contract expired & new contracts as the sum of values of above 3 months and Total Active contracts as the sum of these 3.

PeriodAttribute Value Year

1-Jan-21Beginning_# Contracts9822021
1-Jan-21Expired_# Contracts-972021
1-Jan-21New_# Contracts1322021
1-Jan-21Total Active_# Contracts10172021
1-Feb-21Beginning_# Contracts10172021
1-Feb-21Expired_# Contracts-942021
1-Feb-21New_# Contracts742021
1-Feb-21Total Active_# Contracts9972021
1-Mar-21Beginning_# Contracts9972021
1-Mar-21Expired_# Contracts-892021
1-Mar-21New_# Contracts1012021
1-Mar-21Total Active_# Contracts10092021
1-Apr-21Beginning_# Contracts10092021
1-Apr-21Expired_# Contracts-632021
1-Apr-21New_# Contracts832021
1-Apr-21Total Active_# Contracts10292021
1-May-21Beginning_# Contracts10292021
1-May-21Expired_# Contracts-762021
1-May-21New_# Contracts702021
1-May-21Total Active_# Contracts10232021



Expected result:

Beginning_# Contracts997
Expired_# Contracts-228
New_# Contracts254
Total Active_# Contracts1023

 

 

 

Hi @shareezsaleem ,

Can you try with the below DAX. This works fine as per my testing

 

newvalue = 
IF(MAX('Table'[Particulars]) = "Beginning_# Contracts",
VAR temptable = TOPN(1,
                    ADDCOLUMNS('Table', "@difference", MONTH('Table'[Date]) - SELECTEDVALUE('Date'[Month])), [@difference], ASC)
return
    MINX(temptable, 'Table'[Value]),
    IF(MAX('Table'[Particulars]) = "Total Active_# Contracts",
VAR temptable = TOPN(1,
                    ADDCOLUMNS('Table', "@difference", MONTH('Table'[Date]) - SELECTEDVALUE('Date'[Month])), [@difference], DESC)
return
    MAXX(temptable, 'Table'[Value]),
    SUM('Table'[Value])))

 

Below is the screenshot

Thejeswar_0-1646137826368.png

 

If this solves your requirement, mark it as solution!! Appreciate with your Kudos!!

Regards,

 

tej147
Frequent Visitor

If you are talking about summary table calculated with DAX to get affected by slicers. Then you need to create a relationship between new summarized table and the calender table based on date column. Once relationship is created, you can filter the data based on slicers.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.