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
MyPI
Regular Visitor

How to select a subset of a table by a Date Slicer and then group it twice by multiple columns?

Input Table1

Table1.PNG

Use a Date slicer to pick up the date range from 11/29/2022 to 11/30/2022 get Table 2:

Table2.PNG

 

Calculate the Total_Availability_By_Group by groupping the Product_Name, Product_Type and Availability_Type to get Table 3:

Table3.PNG

 

Finally, calculate the IB-OB by groupping the Product_Name and the Product_Type to get Table 4:

Table4.PNG
Any idea how to get the IB-OB or the Table 4 with Dax functions? Thank you!

2 REPLIES 2
wdx223_Daniel
Super User
Super User

put Product_Name and Product_Type on the rows and try this measure

IB-OB=CALCULATE(SUM(Table[Availablity]),Table[Availability_Type]="IB")-CALCULATE(SUM(Table[Availablity]),Table[Availability_Type]="OB")

Hi wdx223_Daniel,


Thank you for your suggestion.

However, all I have is the input Table 1, whereas the Table 2, Table 3 and Table 4 are just virtual tables which are assume to be obtained after the processing specified at each step. What I would like to know is:
1. how to get Table 2 from Table 1 with dax function?

2. how to get Table 3 from Table 2 with dax function?

3. how to get Table 4 from Table 3 with dax function?


In other words, what is the right dax function to get the IB-OB from Table?

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.

Top Solution Authors